我制作了一个博客应用程序,其中有用于编写博客的表单。它有一个 title
字段、一个用于博客正文的 tinymce 编辑器
实例、一个用于添加标签
的文本字段以及提交按钮。
我想要做的是默认情况下在页面加载时向用户显示整个表单。用户可以填写标题。现在,当用户使用文本编辑器时,将有一个按钮,单击该按钮将仅在模式窗口中打开文本编辑器,并且用户可以在该按钮中键入内容。
一旦用户单击十字,文本就会复制到底层文本编辑器。我不太擅长 javascript,我看过一些博客,但这没有帮助。任何指示将不胜感激。我正在添加博客页面的快照。
I have made a blog application where I have this form for writing the blog. It has a title
field, an instance of of tinymce editor
for the blog body, a text field for adding tags
and the submit button.
What I want to do is to by default show the whole form to the user when the page loads. The user can fill in the title. Now when the user comes on the text-editor, there will be a button on clicking which only the text editor will open in the modal window and the user can type in that.
Once the user clicks on the cross, then the text is copied to the underlying text editor. I am not that good at javascript and I have looked a few blogs, but that didn't help. Any directions will be really appreciated. I am adding a snapshot of how the blog page looks like.
发布评论
评论(1)
您需要首先使用以下内容初始化您的 TinyMCE 编辑器(添加您想要的任何选项):
您可以设置任何 模式 你喜欢,但我会选择动态创建(模式:无),因为它给你更多的控制权。在“任何代码”中初始化您的模态,然后使用以下代码在模态中创建编辑器:
要获取/设置编辑器的内容,您需要执行以下操作:
在关闭模态或它之前,您需要关闭tinyMCE编辑器下次模式打开时将无法加载。要关闭它,您需要执行以下代码:
You need to start off by initializing your TinyMCE editor with something like this (add in any options you want):
You can set up any mode you like but I'm going to go with dynamic creation (mode: none) because it gives you more control. Initialize your modal in "whatever code" then create your editor inside the modal with the code below:
To get/set the content of your editor you would do this:
You'll need to close your tinyMCE editor before you close your modal or it will fail to load next time the modal opens. To close it you need to execute the following code: