0
非常新穎的tinymce和嘗試一個相當大的(對我來說)定製 - 嘗試搜索,但不夠清楚,知道我在找什麼...使用下面的代碼(只顯示頂部一半),一切都工作得很好,除了我不能讓簡碼項目插入光標loc點擊 - 我嘗試了一些變化,但沒有任何工作。 onclick仍然是適當的方法?任何想法不勝感激。tinymce插入內容 - onclick
TxtEdit = new tinymce.Editor(id, {
inline: true,
plugins: [
"autolink lists link image charmap code insertdatetime table",
"contextmenu paste textcolor colorpicker textpattern",
],
toolbar: "undo redo | styleselect | formatselect | pastetext | bold italic underline | alignleft aligncenter alignright | forecolor backcolor | bullist numlist | link | removeformat | fontselect fontsizeselect | code",
menubar: false,
paste_word_valid_elements: "b,strong,i,em,h1,h2",
relative_urls : false,
convert_urls : false,
style_formats: [
{title: "Shortcodes", items: [
{title: 'Name', onclick: function() {editor.insertContent('[st_user_name_style target= ]');}},
{title: 'Email', onclick: function() {editor.insertContent('[st_user_email_1_style target= ]');}}
]},
{title: "Inline", items: [
{title: "Strikethrough", icon: "strikethrough", format: "strikethrough"},
{title: "Superscript", icon: "superscript", format: "superscript"},
{title: "Subscript", icon: "subscript", format: "subscript"},
{title: "Code", icon: "code", format: "code"}
]},
{title: "Blocks", items: [
{title: "Blockquote", format: "blockquote"},
{title: "Div", format: "div"},
{title: "Pre", format: "pre"}
]},
你試過http://stackoverflow.com/questions/1064089/inserting-a-text-where-cursor-is-using-javascript-jquery – enigma
謝謝,但這個問題不針對tinymce,這是我想在這裏配置。因此,我一直在嘗試爲tinymce提供變體 - 這個構造中的某些東西應該可以工作。 'insertContent'就我所知的正確方法而言 - 但我顯然沒有把它調用正確的... – wolff