2017-03-29 7 views

答えて

1

は、あなたが何をする必要があるかについて概要です:

// get a reference to the Editor instance 
// (depending on your scenario, this may come from a different place) 
var editor = tinymce.activeEditor; 

// get the node your cursor is in - the one you want to insert after 
var endNode = editor.selection.getEnd(); 

// move the selection after the current node 
editor.selection.select(endNode).collapse(false); 

// insert your content 
editor.selection.setContent("abc"); 

あなたが実際にそれを動作させるためにthe API docsを使用することができます。私が上に書いたのは、厳密にドキュメントに基づいています - 私は今それをテストする時間がないので、おそらくプラグアンドプレイではありません。

+1

ありがとう@Alin Purcaru ... 3行目のマイナーチェンジ。 'editor.selection.collapse();'は私のために働いていました。 –

+0

yea、3行目は実際には2行でなければなりません: 'editor.selection.select(endNode); editor.selection.collapse(false); ' – mroncetwice

関連する問題