tinyMCE.execInstanceCommand("content", "mceFocus");
我已經試過
tinyMCE.execCommand('mceFocus', false, "content");
他們似乎都不:-(
tinyMCE.execInstanceCommand("content", "mceFocus");
我已經試過
tinyMCE.execCommand('mceFocus', false, "content");
他們似乎都不:-(
好工作,我陷入了同樣的問題,但我相信這取決於你在哪裏執行代碼。以下是我迄今爲止發現的各種鏈接:
http://tinymce.moxiecode.com/forum/viewtopic.php?id=8238
http://tinymce.moxiecode.com/forum/viewtopic.php?pid=91307#p91307
但我解決我的問題,以下內容,它可能不適用於你:
this.focus();
this.tinymce.execCommand('mceFocus', false, 'yourTinyMCEtextAreaID_goes_here');
此代碼tiny_mce_src.js內部應用 - > InsertHorizontalRule,這樣你就可以對範圍有所瞭解。
希望有幫助。
有一個比以前建議的代碼更簡單的方法。初始化tinymce時,可以選擇設置配置參數。只要確保您設置了AUTOFOCUS選項。
var editorOptions = {
script_url: "/scripts/tinymce/tiny_mce.js",
theme: "advanced",
entities: "",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,
content_css: "/styles/site.css",
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",
theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,help",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_buttons4: "",
width: "640",
height: "220",
auto_focus: "body2"
};
這是迄今爲止最好的迴應! IMO應該是真正的答案。 – 2013-04-29 21:38:34
觸發焦點與auto_focus不同。這可能在TinyMCE啓動時起作用,但就是這樣。這並沒有具體回答OP的問題。 – Aknosis 2013-10-22 17:02:24
我使用TinyMCE的3.4與微小兩個 「先進」 的情況下,嘗試這種在Safari 5.0.4,火狐3.6.13和Mac OSX 10.6.6谷歌瀏覽器10.0和Win XP的IE 8。在所有情況下,重點轉移到指定的實例。你可以詳細說明什麼時候調用這些,TinyMCE,Browser,OS的版本是什麼? – 2011-03-16 03:44:16