[sourcecode language='js'] var myEditor = new YAHOO.widget.Editor(‘editor’, config); myEditor.on(‘editorContentLoaded’, function() { myEditor.setEditorHTML(‘This is my new content’); }); myEditor.render(); [/sourcecode] 要 listening editorContentLoaded event 才行 沒在editorContentLoaded 裡下…………. myEditor.setEditorHTML(‘This is my new content’); 沒作用………
posted in program by johnpupu
在<body> 這個tag 似乎一定要設 class=’yui-skin-sam’ 不然會有一些小問題 我之前是設在<div class=’yui-skin-sam’><textarea></textarea></div> 這樣來解 ..不過… 用了一陣子才發現….class=’yui-skin-sam’不是設在body 的話…. add link 的這個func 會破版…………..css 會整個走掉…. 本來是沒有很想加 class 在body 的.. 不過突然想到….drupal 的 plugin 中也有yui rte 我就去看了一下他是怎麼解的.. [sourcecode language='js'] [/sourcecode] 然後看了一下skin裡面的css 應該是不至於加了這個class 造成新版的走位,所以就照著幹了…
posted in program by johnpupu
因為有打算用YUI RTE 來做default 的editor 不過因為有想要在textarea 裡面加入content 的須求 用document.post_form.post_text.value 會沒辦法在”所見即所得模式”下有反應 只能在原始碼模式下有作用 翻了一下文件 要用cmd_inserthtml來做 如下 [sourcecode language='js'] myEditor = YAHOO.widget.EditorInfo.getEditorById(‘post_text’); myEditor.execCommand(‘inserthtml’, document.post_form.post_text.value); [/sourcecode] 這樣應該就搞定了…
posted in program by johnpupu