var wgetFrame = window.frames [0] wframeDoc = wgetFrame.document;使用execCommand應用字體大小
editor.focus();
editor.execCommand('bold');
wframeDoc.execCommand('forecolor',false,'#00ff00');
wframeDoc.execCommand('JustifyCenter', false, null);
wframeDoc.execCommand('fontsize', false, 15);
(ⅰ使用上面的代碼中的CKEditor一個插件)
粗體,前景色和中間對齊,它們都corectly撕裂,選定的文本是由跨接元件
但應用時包裹所選的字體在字體元素中, 我知道這是正確的,但它需要它在一個跨度元素內
我需要知道爲什麼粗體,forecolor和JustifyCenter被span和f ontsize不是!
而且,如果有另一種方式來應用該樣式
(PS:我運行這些命令時CKEditor的初始化,即使editort不包含任何文本,當u寫definied應用的樣式)
CKEDITOR.editorConfig = function(config) {
CKEDITOR.addStylesSet('customStyles',
[
{ name: 'Header 1', element: 'h1' },
{ name: 'Header 2', element: 'h2' },
{ name: 'Header 3', element: 'h3' },
{ name: 'Text', element: 'p' },
{ name: 'Left Align', element: 'img', attributes: { 'class': 'ImageLeft'} },
{ name: 'Right Align', element: 'img', attributes: { 'class': 'ImageRight'} }
]);
};
我可以應用editor.execCommand(「Header 1」); ??