gui 에디터 추가

This commit is contained in:
2018-08-30 01:25:45 +09:00
parent 9e677f3871
commit accc083702
74 changed files with 7344 additions and 8 deletions
@@ -0,0 +1,88 @@
/* ===========================================================
* trumbowyg.mathMl.js v1.0
* MathML plugin for Trumbowyg
* https://github.com/loclamor/Trumbowyg/tree/mathml-plugin/plugins/mathml
* ===========================================================
* Author : loclamor
*/
/* globals MathJax */
(function($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
en: {
mathml: 'Insert Formulas',
formulas: 'Formulas',
inline: 'Inline'
},
fr: {
mathml: 'Inserer une formule',
formulas: 'Formule',
inline: 'En ligne'
},
tr: {
mathml: 'Formül Ekle',
formulas: 'Formüller',
inline: 'Satır içi'
}
},
plugins: {
mathml: {
init: function(trumbowyg) {
var btnDef = {
fn: function() {
trumbowyg.saveRange();
var mathMLoptions = {
formulas: {
label: trumbowyg.lang.formulas,
required: true,
value: ''
},
inline: {
label: trumbowyg.lang.inline,
attributes: {
checked: true
},
type: 'checkbox',
required: false,
}
};
var mathmlCallback = function(v) {
var delimitor = v.inline ? '$' : '$$';
if (trumbowyg.currentMathNode) {
$(trumbowyg.currentMathNode).html(delimitor + ' ' + v.formulas + ' ' + delimitor).attr('formulas', v.formulas).attr('inline', (v.inline ? 'true' : 'false'));
} else {
var html = '<span class="mathMlContainer" contenteditable="false" formulas="' + v.formulas + '" inline="' + (v.inline ? 'true' : 'false') + '" >' + delimitor + ' ' + v.formulas + ' ' + delimitor + '</span>';
var node = $(html)[0];
node.onclick = function(e) {
trumbowyg.currentMathNode = this;
mathMLoptions.formulas.value = $(this).attr('formulas');
if ($(this).attr('inline') === "true") {
mathMLoptions.inline.attributes.checked = true;
} else {
delete mathMLoptions.inline.attributes.checked;
}
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
};
trumbowyg.range.deleteContents();
trumbowyg.range.insertNode(node);
}
trumbowyg.currentMathNode = false;
MathJax.Hub.Queue(['Typeset', MathJax.Hub]);
return true;
};
mathMLoptions.formulas.value = trumbowyg.getRangeText();
mathMLoptions.inline.attributes.checked = true;
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
}
};
trumbowyg.addBtnDef('mathml', btnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1 @@
!function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{mathml:"Insert Formulas",formulas:"Formulas",inline:"Inline"},fr:{mathml:"Inserer une formule",formulas:"Formule",inline:"En ligne"},tr:{mathml:"Formül Ekle",formulas:"Formüller",inline:"Satır içi"}},plugins:{mathml:{init:function(n){var t={fn:function(){n.saveRange();var t={formulas:{label:n.lang.formulas,required:!0,value:""},inline:{label:n.lang.inline,attributes:{checked:!0},type:"checkbox",required:!1}},a=function(l){var r=l.inline?"$":"$$";if(n.currentMathNode)e(n.currentMathNode).html(r+" "+l.formulas+" "+r).attr("formulas",l.formulas).attr("inline",l.inline?"true":"false");else{var i='<span class="mathMlContainer" contenteditable="false" formulas="'+l.formulas+'" inline="'+(l.inline?"true":"false")+'" >'+r+" "+l.formulas+" "+r+"</span>",u=e(i)[0];u.onclick=function(l){n.currentMathNode=this,t.formulas.value=e(this).attr("formulas"),"true"===e(this).attr("inline")?t.inline.attributes.checked=!0:delete t.inline.attributes.checked,n.openModalInsert(n.lang.mathml,t,a)},n.range.deleteContents(),n.range.insertNode(u)}return n.currentMathNode=!1,MathJax.Hub.Queue(["Typeset",MathJax.Hub]),!0};t.formulas.value=n.getRangeText(),t.inline.attributes.checked=!0,n.openModalInsert(n.lang.mathml,t,a)}};n.addBtnDef("mathml",t)}}}})}(jQuery);
@@ -0,0 +1,36 @@
/**
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
* Default stylesheet for Trumbowyg editor plugin
* ------------------------
* @link http://alex-d.github.io/Trumbowyg
* @license MIT
* @author Alexandre Demode (Alex-D)
* Twitter : @AlexandreDemode
* Website : alex-d.fr
*/
.mathMlContainer {
position: relative;
&[inline="false"] {
display: block;
width: 100%;
}
&:hover {
pointer-events: none;
&:after {
content: '\270E';
pointer-events: auto;
position: absolute;
left: 0px;
top: 0px;
background-color: #ffffffd4;
cursor: pointer;
bottom: 0px;
right: 0px;
box-shadow: 0 0 5px 5px #ffffffd4;
}
}
}
@@ -0,0 +1,29 @@
/**
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
* Trumbowyg plugin stylesheet
* ------------------------
* @link http://alex-d.github.io/Trumbowyg
* @license MIT
* @author Alexandre Demode (Alex-D)
* Twitter : @AlexandreDemode
* Website : alex-d.fr
*/
.mathMlContainer {
position: relative; }
.mathMlContainer[inline="false"] {
display: block;
width: 100%; }
.mathMlContainer:hover {
pointer-events: none; }
.mathMlContainer:hover:after {
content: '\270E';
pointer-events: auto;
position: absolute;
left: 0px;
top: 0px;
background-color: #ffffffd4;
cursor: pointer;
bottom: 0px;
right: 0px;
box-shadow: 0 0 5px 5px #ffffffd4; }
@@ -0,0 +1,2 @@
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
.mathMlContainer{position:relative}.mathMlContainer[inline=false]{display:block;width:100%}.mathMlContainer:hover{pointer-events:none}.mathMlContainer:hover:after{content:'\270E';pointer-events:auto;position:absolute;left:0;top:0;background-color:#fffd4;cursor:pointer;bottom:0;right:0;box-shadow:0 0 5px 5px #fffd4}