editor i18n
This commit is contained in:
8
public/tinymce/plugins/codemirror/langs/zh.js
Normal file
8
public/tinymce/plugins/codemirror/langs/zh.js
Normal file
@ -0,0 +1,8 @@
|
||||
tinymce.addI18n('zh',{
|
||||
'HTML source code': 'HTML源码',
|
||||
'Start search': '查找',
|
||||
'Find next': '下一个',
|
||||
'Find previous': '前一个',
|
||||
'Replace': '替换',
|
||||
'Replace all': '替换所有'
|
||||
});
|
4
public/tinymce/plugins/leanote_code/langs/en.js
Normal file
4
public/tinymce/plugins/leanote_code/langs/en.js
Normal file
@ -0,0 +1,4 @@
|
||||
tinymce.addI18n('en',{
|
||||
codeLang: "Language",
|
||||
toggleCode: "`ctrl+shift+c` toggle code"
|
||||
});
|
4
public/tinymce/plugins/leanote_code/langs/zh.js
Normal file
4
public/tinymce/plugins/leanote_code/langs/zh.js
Normal file
@ -0,0 +1,4 @@
|
||||
tinymce.addI18n('zh',{
|
||||
codeLang: "代码语言",
|
||||
toggleCode: "ctrl+shift+c 切换代码"
|
||||
});
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* leanote code plugin
|
||||
*/
|
||||
|
||||
tinymce.PluginManager.requireLangPack('leanote_code');
|
||||
|
||||
tinymce.PluginManager.add('leanote_code', function(editor, url) {
|
||||
var ed = editor;
|
||||
|
||||
@ -75,8 +81,8 @@ tinymce.PluginManager.add('leanote_code', function(editor, url) {
|
||||
}
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: "代码语言",
|
||||
tooltip: "ctrl+shift+c 切换代码",
|
||||
text: "codeLang",
|
||||
tooltip: "toggleCode",
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onselect: function(e) {
|
||||
|
@ -1 +1 @@
|
||||
tinymce.PluginManager.add("leanote_code",function(t){function e(t){var e,o=n.selection.getNode(),r=n.selection.getContent(),a=n.selection.getBookmark();if("PRE"==o.nodeName)$(o).attr("class","brush:"+t);else{if("BODY"==o.nodeName)return;try{e=$(r).text()}catch(c){}e?n.insertContent('<pre class="brush:'+t+'"> '+e+"</pre>"):(e=$(o).text(),$(o).replaceWith('<pre class="brush:'+t+'"> '+e+"</pre>"))}n.selection.moveToBookmark(a)}function o(){return function(){var e=this;t.on("nodeChange",function(){var o=null;try{var n=t.selection.getNode();"PRE"==n.nodeName&&(o=$.trim($(n).attr("class").split(":")[1]))}catch(r){}e.value(o)})}}var n=t;t.addButton("leanote_code",function(){var t=["CSS:css","C/C++:cpp","C#:c#","Javascript:javascript","Java:java","PHP:php","Python:python","Shell:shell","Delphi:delphi","Golang:golang","Erlang:erlang","Groovy:groovy","ActionScript:actionScript"],n=[];for(var r in t){var a=t[r].split(":");n.push({text:a[0],value:a[1]})}return{type:"listbox",text:"代码语言",tooltip:"ctrl+shift+c 切换代码",values:n,fixedWidth:!0,onselect:function(t){t.control.settings.value&&e(t.control.settings.value)},onPostRender:o(n)}}),n.addCommand("toggleCode",function(){var t,e=n.selection.getNode(),o=n.selection.getContent(),r=n.selection.getBookmark();try{t=$.trim($(o).text())}catch(a){}t||(t=$.trim(o)),t?"PRE"==e.nodeName?$(e).replaceWith("<p>"+$(e).html()+"</p>"):n.insertContent("<pre>"+t+"</pre>"):$(e).replaceWith("PRE"==e.nodeName?"<p>"+$(e).html().replace(/\n/g,"<br />")+"</p>":"<pre>"+$(e).html()+"</pre>"),n.selection.moveToBookmark(r)}),n.addShortcut("ctrl+shift+c","","toggleCode"),n.addShortcut("command+shift+c","","toggleCode")});
|
||||
tinymce.PluginManager.requireLangPack("leanote_code"),tinymce.PluginManager.add("leanote_code",function(e){function t(e){var t,o=n.selection.getNode(),a=n.selection.getContent(),r=n.selection.getBookmark();if("PRE"==o.nodeName)$(o).attr("class","brush:"+e);else{if("BODY"==o.nodeName)return;try{t=$(a).text()}catch(c){}t?n.insertContent('<pre class="brush:'+e+'"> '+t+"</pre>"):(t=$(o).text(),$(o).replaceWith('<pre class="brush:'+e+'"> '+t+"</pre>"))}n.selection.moveToBookmark(r)}function o(){return function(){var t=this;e.on("nodeChange",function(){var o=null;try{var n=e.selection.getNode();"PRE"==n.nodeName&&(o=$.trim($(n).attr("class").split(":")[1]))}catch(a){}t.value(o)})}}var n=e;e.addButton("leanote_code",function(){var e=["CSS:css","C/C++:cpp","C#:c#","Javascript:javascript","Java:java","PHP:php","Python:python","Shell:shell","Delphi:delphi","Golang:golang","Erlang:erlang","Groovy:groovy","ActionScript:actionScript"],n=[];for(var a in e){var r=e[a].split(":");n.push({text:r[0],value:r[1]})}return{type:"listbox",text:"codeLang",tooltip:"toggleCode",values:n,fixedWidth:!0,onselect:function(e){e.control.settings.value&&t(e.control.settings.value)},onPostRender:o(n)}}),n.addCommand("toggleCode",function(){var e,t=n.selection.getNode(),o=n.selection.getContent(),a=n.selection.getBookmark();try{e=$.trim($(o).text())}catch(r){}e||(e=$.trim(o)),e?"PRE"==t.nodeName?$(t).replaceWith("<p>"+$(t).html()+"</p>"):n.insertContent("<pre>"+e+"</pre>"):$(t).replaceWith("PRE"==t.nodeName?"<p>"+$(t).html().replace(/\n/g,"<br />")+"</p>":"<pre>"+$(t).html()+"</pre>"),n.selection.moveToBookmark(a)}),n.addShortcut("ctrl+shift+c","","toggleCode"),n.addShortcut("command+shift+c","","toggleCode")});
|
Reference in New Issue
Block a user