1

TinyMCE には、formats および style_formats コードと組み合わせて使用​​する変数を渡す方法があります。

// Registering the special format with a variable
tinymce.activeEditor.formatter.register('custom_format', {inline : 'span', styles : {color : '%value'}});

// Applying the specified format with the variable specified
tinymce.activeEditor.formatter.apply('custom_format', {value : 'red'});

組み込みの styleselect の動作を拡張して、便利なヘルパー変数を追加するにはどうすればよいですか? 特に、スタイルが適用されている選択したテキストへのアクセスが必要です。

// Registering the special format with a variable
tinymce.activeEditor.formatter.register('custom_format', {inline : 'span', attributes : {data-content : '%content'}});

// Applying the specified format with the variable specified
tinymce.activeEditor.formatter.apply('custom_format', {content : tinymce.activeEditor.selection });

カスタムボタンを介してこれを行う方法はわかりますが、WordPress での作業が容易になるため、styleselect と統合したいと考えています。

JS の専門家は私を正しい方向に向けることができますか? 私はまだOOスタイルのjavascriptと、正確に何が達成できるかについて少し苦労しています。

4

0 に答える 0