File modules/editor/trumbowyg/plugins/ruby/trumbowyg.ruby.js
Last commit: Tue Aug 28 00:33:27 2018 +0200 Jan Dankert Editoren für Markdown (SimpleMDE) und HTML (Trumbowyg) installiert.
1 /* =========================================================== 2 * trumbowyg.ruby.js v1.0 3 * Ruby text plugin for Trumbowyg 4 * http://alex-d.github.com/Trumbowyg 5 * =========================================================== 6 * Author : Fathi Anshory (0x00000F5C) 7 * Twitter : @fscchannl 8 * Comment : Since I use trumbowyg in my project and required it to insert ruby text, so I thought I can contribute a little. :D 9 */ 10 11 (function ($) { 12 'use strict'; 13 14 $.extend(true, $.trumbowyg, { 15 langs: { 16 en: { 17 ruby: 'Add ruby text', 18 rubyModal: 'Ruby modal', 19 rubyText: 'Ruby text' 20 }, 21 fr: { 22 ruby: 'Ajouter du texte ruby', 23 rubyModal: 'Modale ruby', 24 rubyText: 'Texte ruby' 25 }, 26 id: { 27 ruby: 'Sisipkan teks ruby', 28 rubyModal: 'Modal teks ruby', 29 rubyText: 'Teks ruby' 30 }, 31 tr: { 32 ruby: 'Ruby metni ekle', 33 rubyModal: 'Ruby modal', 34 rubyText: 'Ruby metni' 35 } 36 }, 37 plugins: { 38 ruby: { 39 init: function (trumbowyg) { 40 var btnDef = { 41 fn: function () { 42 trumbowyg.saveRange(); 43 trumbowyg.openModalInsert( 44 trumbowyg.lang.ruby, 45 { 46 rubyText: { 47 label: trumbowyg.lang.rubyText, 48 required: false, 49 }, 50 modal: { 51 label: trumbowyg.lang.rubyModal, 52 value: trumbowyg.getRangeText(), 53 required: true 54 } 55 }, 56 function (v) { 57 var node = $('<ruby title="' + v.rubyText + '">' + v.modal + '<rp> (</rp><rt>' + v.rubyText + '</rt><rp>)</rp></ruby>')[0]; 58 trumbowyg.range.deleteContents(); 59 trumbowyg.range.insertNode(node); 60 trumbowyg.syncCode(); 61 trumbowyg.$c.trigger('tbwchange'); 62 return true; 63 } 64 ); 65 } 66 }; 67 trumbowyg.addBtnDef('ruby', btnDef); 68 } 69 } 70 } 71 }); 72 })(jQuery);
Downloadmodules/editor/trumbowyg/plugins/ruby/trumbowyg.ruby.js
History Tue, 28 Aug 2018 00:33:27 +0200 Jan Dankert Editoren für Markdown (SimpleMDE) und HTML (Trumbowyg) installiert.