English 中文(简体)
如何在微型计算机中使用自定义工具栏?
原标题:How to use customized tool bar in tiny mce?
  • 时间:2010-10-15 05:49:24
  •  标签:
  • tinymce

我在我的一个项目中使用了微小的mce,客户不想使用微小mce的水平工具栏。他想要一个集中的自定义工具栏,用户可以从中控制所有属性,如文本颜色、文本类型、大小、背景以及使用模板设计网页时需要做的每一件事。我在没有默认工具栏的情况下配置了mce实例,并从自定义工具栏控制了属性。并且将这些属性作为一个整体应用于微小的mce实例。但现在,有人提出了这样的要求,即文本编辑应采用MS office风格。这意味着,如果用户将光标放在一个位置并更改颜色,则不会影响任何内容,但如果用户从光标位置开始键入,则文本应具有最近设置的颜色。我尝试使用外部工具栏选项。但是,我的工作区域和自定义工具栏处于不同的z索引级别。因此,定位工具栏失败。如果我将工具栏附加到我的自定义工具栏,它是不可点击的。那么,如何使用自定义工具栏调用微小mce的核心功能呢?

或者,请建议,我应该换编辑吗?那么,我应该选哪一个呢?

EDIT As per the suggestion, I m writing the function save the property styles and insert the span at caret position. But I m facing some problems and could not do it after spending whole day. I could add span at caret position by using following code.

 marker = ed.selection.getBookmark();
 ed.selection.moveToBookmark(marker);
 tinyMCE.execCommand( mceInsertContent ,false, <span id="mytitle"></span> );

但是,我还是没能在新的跨度内打字。此外,我不知道如何将样式设置为这个跨度。

问题回答

If your aim is to have your tinymce behave like MS Office you should write an own plugin which will take care of this. I suggest if a user has placed the cursor at one place and changes color you save this color as a setting to your tinymce instance like: ed.color = choosencolor ;

当用户现在开始键入时,您可以在第一次按键时插入一个span,并将颜色设置为css类或样式属性。





相关问题
Tinymce Model Binding with ASP.NET MVC

Does anyone know how to auto-populate the tinymce editor from the ASP.NET MVC model? In other words, what code do I need to use to set the contents of tinymce? EDITED: My problem is that tinyMCE is ...

How to dynamically load & unload a TinyMCE Plugin

Does anyone know if there is a way I can dynamically load and unload a TinyMCE plugin after TinyMCE has already been loaded? Specifically, I m thinking about asking the user whether or not they wish ...

tinyMCE problem with jQuery load

I have a DIV and a Load button on my page and when I click in Load button the jQuery loads a HTML from another file, this HTML file have texteareas and start tinymce. Ex: <script language="...

TinyMCE - adding an ON/OFF toggle switch

I m using TinyMCE on the text-areas in my Magento admin section. I have my TinyMCE editor visible form the start, but I want the option to disable/re-enable it. I m using the jQuery plugin version, ...

My admin panel and upload

I have written an admin panel for my site (im beginner in php). In content.php I have insert tinyMCE editor. I want to upload images from editor. What is the best way to do this. (not very familiar ...

How to click TinyMCE toolbar s button programmatically?

I want to make preview button as usual form button next to submit button(as it made in most cases of "Post new topic" forms). How can I programmatically simulate toolbar s preview button click ? I ...

热门标签