UNPKG

jquery-grid

Version:

jQuery Grid by Gijgo.com is a plug-in for the jQuery Javascript library. It is a very fast and extandable datagrid, and will add advanced interaction controls to any HTML table. This plugin has build-in integration with Bootstrap and Material Design. Free

1 lines 11.7 kB
gj.editor={plugins:{},messages:{}},gj.editor.config={base:{height:300,width:void 0,uiLibrary:"materialdesign",iconsLibrary:"materialicons",locale:"en-us",buttons:void 0,style:{wrapper:"gj-editor gj-editor-md",buttonsGroup:"gj-button-md-group",button:"gj-button-md",buttonActive:"active"}},bootstrap:{style:{wrapper:"gj-editor gj-editor-bootstrap",buttonsGroup:"btn-group",button:"btn btn-default gj-cursor-pointer",buttonActive:"active"}},bootstrap4:{style:{wrapper:"gj-editor gj-editor-bootstrap",buttonsGroup:"btn-group",button:"btn btn-outline-secondary gj-cursor-pointer",buttonActive:"active"}},materialicons:{icons:{bold:'<i class="gj-icon bold" />',italic:'<i class="gj-icon italic" />',strikethrough:'<i class="gj-icon strikethrough" />',underline:'<i class="gj-icon underlined" />',listBulleted:'<i class="gj-icon list-bulleted" />',listNumbered:'<i class="gj-icon list-numbered" />',indentDecrease:'<i class="gj-icon indent-decrease" />',indentIncrease:'<i class="gj-icon indent-increase" />',alignLeft:'<i class="gj-icon align-left" />',alignCenter:'<i class="gj-icon align-center" />',alignRight:'<i class="gj-icon align-right" />',alignJustify:'<i class="gj-icon align-justify" />',undo:'<i class="gj-icon undo" />',redo:'<i class="gj-icon redo" />'}},fontawesome:{icons:{bold:'<i class="fa fa-bold" aria-hidden="true"></i>',italic:'<i class="fa fa-italic" aria-hidden="true"></i>',strikethrough:'<i class="fa fa-strikethrough" aria-hidden="true"></i>',underline:'<i class="fa fa-underline" aria-hidden="true"></i>',listBulleted:'<i class="fa fa-list-ul" aria-hidden="true"></i>',listNumbered:'<i class="fa fa-list-ol" aria-hidden="true"></i>',indentDecrease:'<i class="fa fa-indent" aria-hidden="true"></i>',indentIncrease:'<i class="fa fa-outdent" aria-hidden="true"></i>',alignLeft:'<i class="fa fa-align-left" aria-hidden="true"></i>',alignCenter:'<i class="fa fa-align-center" aria-hidden="true"></i>',alignRight:'<i class="fa fa-align-right" aria-hidden="true"></i>',alignJustify:'<i class="fa fa-align-justify" aria-hidden="true"></i>',undo:'<i class="fa fa-undo" aria-hidden="true"></i>',redo:'<i class="fa fa-repeat" aria-hidden="true"></i>'}}},gj.editor.methods={init:function(a){return gj.widget.prototype.init.call(this,a,"editor"),this.attr("data-editor","true"),gj.editor.methods.initialize(this),this},initialize:function(a){var b,c,d,e,f,g=this,h=a.data();if(a.hide(),"wrapper"!==a[0].parentElement.attributes.role&&(d=document.createElement("div"),d.setAttribute("role","wrapper"),a[0].parentNode.insertBefore(d,a[0]),d.appendChild(a[0])),gj.editor.methods.localization(h),$(d).addClass(h.style.wrapper),h.width&&$(d).width(h.width),e=$(d).children('div[role="body"]'),0===e.length&&(e=$('<div role="body"></div>'),$(d).append(e),a[0].innerText&&(e[0].innerHTML=a[0].innerText)),e.attr("contenteditable",!0),e.on("keydown",function(b){var c=event.keyCode||event.charCode;!1===gj.editor.events.changing(a)&&8!==c&&46!==c&&b.preventDefault()}),e.on("mouseup keyup mouseout cut paste",function(b){g.updateToolbar(a,f),gj.editor.events.changed(a),a.html(e.html())}),f=$(d).children('div[role="toolbar"]'),0===f.length){f=$('<div role="toolbar"></div>'),e.before(f);for(var i in h.buttons){b=$("<div />").addClass(h.style.buttonsGroup);for(var j in h.buttons[i])c=$(h.buttons[i][j]),c.on("click",function(){gj.editor.methods.executeCmd(a,e,f,$(this))}),b.append(c);f.append(b)}}e.height(h.height-gj.core.height(f[0],!0))},localization:function(a){var b=gj.editor.messages[a.locale];void 0===a.buttons&&(a.buttons=[['<button type="button" class="'+a.style.button+'" title="'+b.bold+'" role="bold">'+a.icons.bold+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.italic+'" role="italic">'+a.icons.italic+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.strikethrough+'" role="strikethrough">'+a.icons.strikethrough+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.underline+'" role="underline">'+a.icons.underline+"</button>"],['<button type="button" class="'+a.style.button+'" title="'+b.listBulleted+'" role="insertunorderedlist">'+a.icons.listBulleted+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.listNumbered+'" role="insertorderedlist">'+a.icons.listNumbered+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.indentDecrease+'" role="outdent">'+a.icons.indentDecrease+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.indentIncrease+'" role="indent">'+a.icons.indentIncrease+"</button>"],['<button type="button" class="'+a.style.button+'" title="'+b.alignLeft+'" role="justifyleft">'+a.icons.alignLeft+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.alignCenter+'" role="justifycenter">'+a.icons.alignCenter+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.alignRight+'" role="justifyright">'+a.icons.alignRight+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.alignJustify+'" role="justifyfull">'+a.icons.alignJustify+"</button>"],['<button type="button" class="'+a.style.button+'" title="'+b.undo+'" role="undo">'+a.icons.undo+"</button>",'<button type="button" class="'+a.style.button+'" title="'+b.redo+'" role="redo">'+a.icons.redo+"</button>"]])},updateToolbar:function(a,b){var c=a.data();$buttons=b.find("[role]").each(function(){var a=$(this),b=a.attr("role");b&&document.queryCommandEnabled(b)&&"true"===document.queryCommandValue(b)?a.addClass(c.style.buttonActive):a.removeClass(c.style.buttonActive)})},executeCmd:function(a,b,c,d){b.focus(),document.execCommand(d.attr("role"),!1),gj.editor.methods.updateToolbar(a,c)},content:function(a,b){var c=a.parent().children('div[role="body"]');return void 0===b?c.html():c.html(b)},destroy:function(a){var b;return"true"===a.attr("data-editor")&&(b=a.parent(),b.children('div[role="body"]').remove(),b.children('div[role="toolbar"]').remove(),a.unwrap(),a.removeData(),a.removeAttr("data-guid"),a.removeAttr("data-editor"),a.off(),a.show()),a}},gj.editor.events={changing:function(a){return a.triggerHandler("changing")},changed:function(a){return a.triggerHandler("changed")}},gj.editor.widget=function(a,b){var c=this,d=gj.editor.methods;return c.content=function(a){return d.content(this,a)},c.destroy=function(){return d.destroy(this)},$.extend(a,c),"true"!==a.attr("data-editor")&&d.init.call(a,b),a},gj.editor.widget.prototype=new gj.widget,gj.editor.widget.constructor=gj.editor.widget,function(a){a.fn.editor=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.editor.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.editor.widget(this,a)}}}(jQuery),gj.editor.messages["en-us"]={bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",listBulleted:"List Bulleted",listNumbered:"List Numbered",indentDecrease:"Indent Decrease",indentIncrease:"Indent Increase",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",undo:"Undo",redo:"Redo"},gj.editor.messages["bg-bg"]={bold:"Удебеляване",italic:"Накланяне",strikethrough:"Зачертаване",underline:"Подчертаване",listBulleted:"Списък",listNumbered:"Номериран Списък",indentDecrease:"Намаляване на абзаца",indentIncrease:"Увеличаване на абзаца",alignLeft:"Подравняване в ляво",alignCenter:"Центриране",alignRight:"Подравняване в дясно",alignJustify:"Изравняване",undo:"Назад",redo:"Напред"},gj.editor.messages["fr-fr"]={bold:"Gras",italic:"Italique",strikethrough:"Barré",underline:"Souligné",listBulleted:"Puces",listNumbered:"Numérotation",indentDecrease:"Diminuer le retrait",indentIncrease:"Augmenter le retrait",alignLeft:"Aligner à gauche",alignCenter:"Centrer",alignRight:"Aligner à droite",alignJustify:"Justifier",undo:"Annuler",redo:"Rétablir"},gj.editor.messages["de-de"]={bold:"Fett",italic:"Kursiv",strikethrough:"Durchgestrichen",underline:"Unterstrichen",listBulleted:"Aufzählung",listNumbered:"Nummerierte Liste",indentDecrease:"Einzug verkleinern",indentIncrease:"Einzug vergrößern",alignLeft:"Linksbündig ausrichten",alignCenter:"Zentriert ausrichten",alignRight:"Rechtsbündig ausrichten",alignJustify:"Blocksatz",undo:"Rückgängig",redo:"Wiederholen"},gj.editor.messages["pt-br"]={bold:"Negrito",italic:"Itálico",strikethrough:"Riscar",underline:"Sublinhar",listBulleted:"Lista não ordenada",listNumbered:"Lista ordenada",indentDecrease:"Diminuir recuo",indentIncrease:"Aumentar recuo",alignLeft:"Alinhar à esquerda",alignCenter:"Centralizar",alignRight:"Alinhar à direita",alignJustify:"Justificar",undo:"Desfazer",redo:"Refazer"},gj.editor.messages["ru-ru"]={bold:"Жирный",italic:"Курсив",strikethrough:"Зачеркнутый",underline:"Подчеркнутый",listBulleted:"Список",listNumbered:"Нумерованный список",indentDecrease:"Уменьшить отступ",indentIncrease:"Увеличить отступ",alignLeft:"Выровнять по левому краю",alignCenter:"Выровнять по центру",alignRight:"Выровнять по правому краю",alignJustify:"Выровнять по ширине",undo:"Назад",redo:"Вперед"},gj.editor.messages["es-es"]={bold:"Negrita",italic:"Italica",strikethrough:"Tachado",underline:"Subrayado",listBulleted:"Puntos",listNumbered:"Lista numerada",indentDecrease:"Disminuir indentacion",indentIncrease:"Aumentar indentacion",alignLeft:"Alineación izquierda",alignCenter:"Alineación centrada",alignRight:"Alineación derecha",alignJustify:"Alineación justificada",undo:"Deshacer",redo:"Repetir"},gj.editor.messages["it-it"]={bold:"Grassetto",italic:"Corsivo",strikethrough:"Barrato",underline:"Sottolineato",listBulleted:"Lista puntata",listNumbered:"Lista numerata",indentDecrease:"sposta testo a sinistra",indentIncrease:"sposta testo a destra",alignLeft:"Allineamento a sinistra",alignCenter:"Centrato",alignRight:"Allineamento a destra",alignJustify:"Giustificato",undo:"Annulla",redo:"Ripeti"},gj.editor.messages["tr-tr"]={bold:"Kalın",italic:"İtalik",strikethrough:"Çok Kalın",underline:"Altı Çizgili",listBulleted:"Noktalı",listNumbered:"Rakamlı",indentDecrease:"Girintiyi Azalt",indentIncrease:"Girintiyi Çoğalt",alignLeft:"Sola Yasla",alignCenter:"Ortala",alignRight:"Sağ Yasla",alignJustify:"Yay",undo:"Geri Al",redo:"İleri Al"},gj.editor.messages["ja-jp"]={bold:"太字",italic:"斜体",strikethrough:"打消し線",underline:"下線",listBulleted:"箇条書き",listNumbered:"番号付き箇条書き",indentDecrease:"インデントを減らす",indentIncrease:"インデントを増やす",alignLeft:"左揃え",alignCenter:"中央揃え",alignRight:"右揃え",alignJustify:"両端揃え",undo:"元に戻す",redo:"やり直し"},gj.editor.messages["zh-cn"]={bold:"粗体",italic:"斜体",strikethrough:"删除线",underline:"下划线",listBulleted:"无序列表",listNumbered:"有序列表",indentDecrease:"减少缩进",indentIncrease:"增加缩进",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",undo:"撤销",redo:"重做"},gj.editor.messages["zh-tw"]={bold:"粗體",italic:"斜體",strikethrough:"刪除線",underline:"下劃線",listBulleted:"無序列表",listNumbered:"有序列表",indentDecrease:"減少縮進",indentIncrease:"增加縮進",alignLeft:"左對齊",alignCenter:"居中",alignRight:"右對齊",alignJustify:"兩端對齊",undo:"撤銷",redo:"重做"};