@richscripts2/richtexteditor 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/package.json +34 -0
- package/richtexteditor/lang/rte-lang-af.js +164 -0
- package/richtexteditor/lang/rte-lang-ar.js +164 -0
- package/richtexteditor/lang/rte-lang-bg.js +164 -0
- package/richtexteditor/lang/rte-lang-bn.js +164 -0
- package/richtexteditor/lang/rte-lang-bs.js +164 -0
- package/richtexteditor/lang/rte-lang-ca.js +164 -0
- package/richtexteditor/lang/rte-lang-cs.js +164 -0
- package/richtexteditor/lang/rte-lang-cy.js +164 -0
- package/richtexteditor/lang/rte-lang-da.js +164 -0
- package/richtexteditor/lang/rte-lang-de.js +164 -0
- package/richtexteditor/lang/rte-lang-el.js +164 -0
- package/richtexteditor/lang/rte-lang-en.js +3 -0
- package/richtexteditor/lang/rte-lang-es.js +164 -0
- package/richtexteditor/lang/rte-lang-et.js +164 -0
- package/richtexteditor/lang/rte-lang-fa.js +164 -0
- package/richtexteditor/lang/rte-lang-fi.js +164 -0
- package/richtexteditor/lang/rte-lang-fil.js +164 -0
- package/richtexteditor/lang/rte-lang-fj.js +164 -0
- package/richtexteditor/lang/rte-lang-fr.js +164 -0
- package/richtexteditor/lang/rte-lang-ga.js +164 -0
- package/richtexteditor/lang/rte-lang-gu.js +164 -0
- package/richtexteditor/lang/rte-lang-he.js +164 -0
- package/richtexteditor/lang/rte-lang-hi.js +164 -0
- package/richtexteditor/lang/rte-lang-hr.js +164 -0
- package/richtexteditor/lang/rte-lang-ht.js +164 -0
- package/richtexteditor/lang/rte-lang-hu.js +164 -0
- package/richtexteditor/lang/rte-lang-id.js +164 -0
- package/richtexteditor/lang/rte-lang-is.js +164 -0
- package/richtexteditor/lang/rte-lang-it.js +164 -0
- package/richtexteditor/lang/rte-lang-ja.js +164 -0
- package/richtexteditor/lang/rte-lang-kn.js +164 -0
- package/richtexteditor/lang/rte-lang-ko.js +164 -0
- package/richtexteditor/lang/rte-lang-lt.js +164 -0
- package/richtexteditor/lang/rte-lang-lv.js +164 -0
- package/richtexteditor/lang/rte-lang-mg.js +164 -0
- package/richtexteditor/lang/rte-lang-mi.js +164 -0
- package/richtexteditor/lang/rte-lang-ml.js +164 -0
- package/richtexteditor/lang/rte-lang-mr.js +164 -0
- package/richtexteditor/lang/rte-lang-ms.js +164 -0
- package/richtexteditor/lang/rte-lang-mt.js +164 -0
- package/richtexteditor/lang/rte-lang-mww.js +164 -0
- package/richtexteditor/lang/rte-lang-nb.js +164 -0
- package/richtexteditor/lang/rte-lang-nl.js +164 -0
- package/richtexteditor/lang/rte-lang-otq.js +164 -0
- package/richtexteditor/lang/rte-lang-pa.js +164 -0
- package/richtexteditor/lang/rte-lang-pl.js +164 -0
- package/richtexteditor/lang/rte-lang-pt-pt.js +164 -0
- package/richtexteditor/lang/rte-lang-pt.js +164 -0
- package/richtexteditor/lang/rte-lang-ro.js +164 -0
- package/richtexteditor/lang/rte-lang-ru.js +164 -0
- package/richtexteditor/lang/rte-lang-sk.js +164 -0
- package/richtexteditor/lang/rte-lang-sl.js +164 -0
- package/richtexteditor/lang/rte-lang-sm.js +164 -0
- package/richtexteditor/lang/rte-lang-sr-Cyrl.js +164 -0
- package/richtexteditor/lang/rte-lang-sr-Latn.js +164 -0
- package/richtexteditor/lang/rte-lang-sv.js +164 -0
- package/richtexteditor/lang/rte-lang-sw.js +164 -0
- package/richtexteditor/lang/rte-lang-ta.js +164 -0
- package/richtexteditor/lang/rte-lang-te.js +164 -0
- package/richtexteditor/lang/rte-lang-th.js +164 -0
- package/richtexteditor/lang/rte-lang-tlh-Latn.js +164 -0
- package/richtexteditor/lang/rte-lang-tlh-Piqd.js +164 -0
- package/richtexteditor/lang/rte-lang-to.js +164 -0
- package/richtexteditor/lang/rte-lang-tr.js +164 -0
- package/richtexteditor/lang/rte-lang-ty.js +164 -0
- package/richtexteditor/lang/rte-lang-uk.js +164 -0
- package/richtexteditor/lang/rte-lang-ur.js +164 -0
- package/richtexteditor/lang/rte-lang-vi.js +164 -0
- package/richtexteditor/lang/rte-lang-yua.js +164 -0
- package/richtexteditor/lang/rte-lang-zh-Hans.js +164 -0
- package/richtexteditor/lang/rte-lang-zh-Hant.js +164 -0
- package/richtexteditor/lang/rte-lang.js +1 -0
- package/richtexteditor/plugins/-combine-plugin.txt +2 -0
- package/richtexteditor/plugins/all_plugins.js +1063 -0
- package/richtexteditor/plugins/html2pdf.js +163 -0
- package/richtexteditor/plugins/imageeditor.js +160 -0
- package/richtexteditor/plugins/insertcode.js +316 -0
- package/richtexteditor/plugins/insertemoji.js +258 -0
- package/richtexteditor/plugins/insertgallery.js +82 -0
- package/richtexteditor/plugins/inserttemplate.js +82 -0
- package/richtexteditor/plugins/samples/insertcode_v1.js +76 -0
- package/richtexteditor/plugins/tui.image-editor/fabric.min.js +8 -0
- package/richtexteditor/plugins/tui.image-editor/note.txt +5 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-a.svg +235 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-b.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-c.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-d.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/tui-code-snippet.min.js +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.css +6 -0
- package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.js +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.css +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.js +15 -0
- package/richtexteditor/rte.js +574 -0
- package/richtexteditor/rte_theme_default.css +1755 -0
- package/richtexteditor/runtime/colorpicker_more_ns.htm +2613 -0
- package/richtexteditor/runtime/help.htm +162 -0
- package/richtexteditor/runtime/images/1x1.gif +0 -0
- package/richtexteditor/runtime/images/cpie_Color.cur +0 -0
- package/richtexteditor/runtime/images/cpie_GradientPositionDark.gif +0 -0
- package/richtexteditor/runtime/images/cpie_GradientPositionLight.gif +0 -0
- package/richtexteditor/runtime/images/cpie_VerticalPosition.gif +0 -0
- package/richtexteditor/runtime/images/cpie_WebSafe.gif +0 -0
- package/richtexteditor/runtime/images/cpie_gradients.png +0 -0
- package/richtexteditor/runtime/images/cpns_Color.cur +0 -0
- package/richtexteditor/runtime/images/cpns_ColorSpace1.png +0 -0
- package/richtexteditor/runtime/images/cpns_ColorSpace2.png +0 -0
- package/richtexteditor/runtime/images/cpns_GradientPositionDark.gif +0 -0
- package/richtexteditor/runtime/images/cpns_GradientPositionLight.gif +0 -0
- package/richtexteditor/runtime/images/cpns_Vertical1.png +0 -0
- package/richtexteditor/runtime/images/cpns_Vertical2.png +0 -0
- package/richtexteditor/runtime/images/cpns_VerticalPosition.gif +0 -0
- package/richtexteditor/runtime/images/cpns_WebSafe.gif +0 -0
- package/richtexteditor/runtime/images/cpns_gradients.png +0 -0
- package/richtexteditor/runtime/images/cpns_hue2.png +0 -0
- package/richtexteditor/runtime/images/formbn.gif +0 -0
- package/richtexteditor/runtime/images/multiclavier.gif +0 -0
- package/richtexteditor/runtime/richtexteditor_content.css +362 -0
- package/richtexteditor/runtime/richtexteditor_preview.css +302 -0
- package/richtexteditor/runtime/richtexteditor_preview.js +4 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
if (!RTE_DefaultConfig.svgCode_html2pdf) {
|
|
4
|
+
RTE_DefaultConfig.svgCode_html2pdf = '<svg viewBox="-2 -2 36 36" fill="#5F6368"><polygon points="30 11 30 9 22 9 22 23 24 23 24 17 29 17 29 15 24 15 24 11 30 11"></polygon><path d="M8,9H2V23H4V18H8a2,2,0,0,0,2-2V11A2,2,0,0,0,8,9Zm0,7H4V11H8Z"></path><path d="M16,23H12V9h4a4,4,0,0,1,4,4v6A4,4,0,0,1,16,23Zm-2-2h2a2,2,0,0,0,2-2V13a2,2,0,0,0-2-2H14Z"></path><title>PDF</title></svg>'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
RTE_DefaultConfig.plugin_html2pdf = RTE_Plugin_Html2PDF;
|
|
8
|
+
|
|
9
|
+
function RTE_Plugin_Html2PDF() {
|
|
10
|
+
|
|
11
|
+
var scripturl = "https://raw.githack.com/eKoopmans/html2pdf/master/dist/html2pdf.bundle.js";
|
|
12
|
+
|
|
13
|
+
var obj = this;
|
|
14
|
+
|
|
15
|
+
var config, editor;
|
|
16
|
+
|
|
17
|
+
obj.PluginName = "Html2PDF";
|
|
18
|
+
|
|
19
|
+
obj.InitConfig = function (argconfig) {
|
|
20
|
+
config = argconfig;
|
|
21
|
+
}
|
|
22
|
+
obj.InitEditor = function (argeditor) {
|
|
23
|
+
editor = argeditor;
|
|
24
|
+
|
|
25
|
+
editor.attachEvent("exec_command_html2pdf", function (state, cmd, value) {
|
|
26
|
+
console.log(state, cmd, value);
|
|
27
|
+
obj.DoHtml2PDF();
|
|
28
|
+
state.returnValue = true;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
editor.toolbarFactoryMap["html2pdf"] = function (cmd) {
|
|
32
|
+
//console.log(cmd);
|
|
33
|
+
var span = editor.createToolbarButton(cmd);
|
|
34
|
+
span.style.backgroundColor = ''
|
|
35
|
+
return span;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function __Append(parent, tagname, csstext, cssclass) {
|
|
41
|
+
var tag = parent.ownerDocument.createElement(tagname);
|
|
42
|
+
if (csstext) tag.style.cssText = csstext;
|
|
43
|
+
if (cssclass) tag.className = cssclass;
|
|
44
|
+
parent.appendChild(tag);
|
|
45
|
+
return tag;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function dataURLToBlob(dataurl) {
|
|
50
|
+
var arr = dataurl.split(',');
|
|
51
|
+
var mime = arr[0].match(/:(.*?);/)[1];
|
|
52
|
+
var bstr = atob(arr[1]);
|
|
53
|
+
var n = bstr.length;
|
|
54
|
+
var u8arr = new Uint8Array(n);
|
|
55
|
+
while (n--) {
|
|
56
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
57
|
+
}
|
|
58
|
+
return new Blob([u8arr], { type: mime });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
obj.DoHtml2PDF = function () {
|
|
62
|
+
|
|
63
|
+
var dialoginner = editor.createDialog("Html2PDF", "rte-dialog-html2pdf");
|
|
64
|
+
|
|
65
|
+
var div2 = __Append(dialoginner, "div", "position:relative;text-align:center;");
|
|
66
|
+
|
|
67
|
+
div2.innerHTML = "Loading...";
|
|
68
|
+
|
|
69
|
+
var imgrect = __Append(dialoginner, "div", "position:relative;text-align:center;")
|
|
70
|
+
|
|
71
|
+
window.html2pdf_callback = function (win) {
|
|
72
|
+
|
|
73
|
+
if (!win.html2pdf) {
|
|
74
|
+
div2.innerHTML = "Failed to load script.";
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
div2.innerHTML = "Exporting...";
|
|
79
|
+
|
|
80
|
+
var opt = {
|
|
81
|
+
margin: 0.5,
|
|
82
|
+
filename: 'myfile.pdf',
|
|
83
|
+
image: { type: 'jpeg', quality: 0.98 },
|
|
84
|
+
html2canvas: { scale: 2 },
|
|
85
|
+
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var promimg = win.html2pdf().set(opt).from(win.document.body).outputImg();
|
|
89
|
+
promimg.then(function (img) {
|
|
90
|
+
|
|
91
|
+
var dataurl = img.getAttribute('src');
|
|
92
|
+
if (dataurl.indexOf("base64") == -1) {
|
|
93
|
+
div2.innerHTML = "Error, no data.";
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var imgblob = dataURLToBlob(dataurl);
|
|
98
|
+
console.log(imgblob);
|
|
99
|
+
var imgurl = URL.createObjectURL(imgblob);
|
|
100
|
+
img.setAttribute("src", imgurl);
|
|
101
|
+
|
|
102
|
+
var prom = win.html2pdf().set(opt).from(win.document.body).outputPdf();
|
|
103
|
+
prom.then(function (str) {
|
|
104
|
+
|
|
105
|
+
console.log("done", str.length)
|
|
106
|
+
|
|
107
|
+
var bin = new Array(str.length);
|
|
108
|
+
for (var i = 0; i < str.length; i++)
|
|
109
|
+
bin[i] = str.charCodeAt(i);
|
|
110
|
+
var blob = new Blob([new Uint8Array(bin)], { type: "application/pdf" })
|
|
111
|
+
var url = URL.createObjectURL(blob);
|
|
112
|
+
div2.innerHTML = Math.ceil(str.length / 1024) + "KB Exported<br/><a href='" + url + "' target=_blank>Download PDF</a>";
|
|
113
|
+
|
|
114
|
+
var pdflink = div2.querySelector("a");
|
|
115
|
+
|
|
116
|
+
var date = new Date();
|
|
117
|
+
var ymd = String(date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate()).substring(2);
|
|
118
|
+
var hms = String(1000000 + date.getHours() * 10000 + date.getMinutes() * 100 + date.getSeconds()).substring(1);
|
|
119
|
+
pdflink.download = "Export-" + ymd + "-" + hms + ".pdf";
|
|
120
|
+
|
|
121
|
+
//a.rel = 'noopener'
|
|
122
|
+
|
|
123
|
+
pdflink.click();
|
|
124
|
+
|
|
125
|
+
img.style.cssText = "max-width:300px;max-height:200px;margin:5px;padding:10px;border:solid 1px #eee;box-shadow:2px 2px 6px #eee"
|
|
126
|
+
imgrect.appendChild(img)
|
|
127
|
+
|
|
128
|
+
__Append(imgrect, "br");
|
|
129
|
+
var imglink = __Append(imgrect, "a");
|
|
130
|
+
imglink.setAttribute("href", imgurl);
|
|
131
|
+
imglink.setAttribute("target", "_blank");
|
|
132
|
+
imglink.download = "Export-" + ymd + "-" + hms + ".jpg";
|
|
133
|
+
imglink.innerText = "Download Img";
|
|
134
|
+
|
|
135
|
+
//dialoginner.close();
|
|
136
|
+
|
|
137
|
+
}).catch(function (x) {
|
|
138
|
+
console.error(x);
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
}).catch(function (x) {
|
|
142
|
+
console.error(x);
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
var div1 = __Append(dialoginner, "div", "position:relative;text-align:center;");
|
|
149
|
+
|
|
150
|
+
iframe = __Append(div1, "iframe", "align-self:center;flex:99;width:100%;height:0px;border:0px;", "rte-editable");
|
|
151
|
+
iframe.contentDocument.open("text/html");
|
|
152
|
+
iframe.contentDocument.write("<html><head><link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(config.previewCssUrl) + "'/>"
|
|
153
|
+
+ "<script src='" + editor.htmlEncode(scripturl) + "'></script></head><body style='padding:10px;margin:0px'>"
|
|
154
|
+
+ editor.getHTMLCode() + "</body>"
|
|
155
|
+
+ "<script>window.onload=function(){setTimeout(function(){parent.html2pdf_callback(window)},100)}</script></html>")
|
|
156
|
+
iframe.contentDocument.close();
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
if (!RTE_DefaultConfig.svgCode_imageeditor) {
|
|
4
|
+
RTE_DefaultConfig.svgCode_imageeditor = '<svg viewBox="-2 -2 20 20" fill="#5F6368"><style>.st0{fill:#f6f6f6}.st1{fill:#424242}.st2{fill:none}.st3{fill:#f0eff1}</style><path class="st0" d="M1 0v6H0v10h10v-1h6V0z" id="outline"/><g id="icon_x5F_bg"><path class="st1" d="M2 5h1v1H2zM2 3h1v1H2zM2 1h1v1H2zM4 1h1.001v1H4zM6 1h1v1H6zM8 1h1v1H8zM10 1h1v1h-1zM12 1h1v1h-1zM14 1h1v1h-1zM14 3h1v1h-1zM14 5h1v1h-1zM14 7h1v1h-1zM14 9h1v1h-1zM14 10.999h1V12h-1zM14 13h1v1h-1zM12 13h1v1h-1zM11 11V5H5v1H4V4h8v7z"/><circle class="st1" cx="6.192" cy="9.807" r=".807"/><path class="st1" d="M1 7v8h8V7H1zm1 7.001v-.28l2.537-1.463L7.554 14l.001.001H2zm6-.93l-3.463-1.982L2 12.491v-4.49h6v5.07zM10 13h1v1h-1z"/></g><g id="icon_x5F_fg"><path class="st2" d="M2 14h5.554v.001H2z"/><path class="st3" d="M11 5v6h-1V6H5V5z"/><path class="st3" d="M2 12.491l2.537-1.402L8 13.071v-5.07H2v4.49zM6.192 9a.807.807 0 1 1 .001 1.615A.807.807 0 0 1 6.192 9z"/><path class="st3" d="M2 13.721V14h5.554l-3.017-1.742z"/></g></svg>';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
RTE_DefaultConfig.plugin_imageeditor = RTE_Plugin_ImageEditor;
|
|
8
|
+
|
|
9
|
+
function RTE_Plugin_ImageEditor() {
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var obj = this;
|
|
14
|
+
|
|
15
|
+
var config, editor;
|
|
16
|
+
|
|
17
|
+
obj.PluginName = "ImageEditor";
|
|
18
|
+
|
|
19
|
+
obj.InitConfig = function (argconfig) {
|
|
20
|
+
config = argconfig;
|
|
21
|
+
}
|
|
22
|
+
obj.InitEditor = function (argeditor) {
|
|
23
|
+
editor = argeditor;
|
|
24
|
+
|
|
25
|
+
editor.attachEvent("exec_command_imageeditor", function (state, cmd, value) {
|
|
26
|
+
obj.DoImageEditor();
|
|
27
|
+
state.returnValue = true;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
editor.toolbarFactoryMap["imageeditor"] = function (cmd) {
|
|
31
|
+
var span = editor.createToolbarButton(cmd);
|
|
32
|
+
span.style.backgroundColor = ''
|
|
33
|
+
return span;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function __Append(parent, tagname, csstext, cssclass) {
|
|
39
|
+
var tag = parent.ownerDocument.createElement(tagname);
|
|
40
|
+
if (csstext) tag.style.cssText = csstext;
|
|
41
|
+
if (cssclass) tag.className = cssclass;
|
|
42
|
+
parent.appendChild(tag);
|
|
43
|
+
return tag;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function dataURLToBlob(dataurl) {
|
|
47
|
+
var arr = dataurl.split(',');
|
|
48
|
+
var mime = arr[0].match(/:(.*?);/)[1];
|
|
49
|
+
var bstr = atob(arr[1]);
|
|
50
|
+
var n = bstr.length;
|
|
51
|
+
var u8arr = new Uint8Array(n);
|
|
52
|
+
while (n--) {
|
|
53
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
54
|
+
}
|
|
55
|
+
return new Blob([u8arr], { type: mime });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
obj.DoImageEditor = function () {
|
|
59
|
+
|
|
60
|
+
var img = editor.getSelectedControl();
|
|
61
|
+
if (!img)
|
|
62
|
+
return;
|
|
63
|
+
|
|
64
|
+
var dialoginner = editor.createDialog("ImageEditor", "rte-dialog-imageeditor");
|
|
65
|
+
|
|
66
|
+
dialoginner.style.width = "90%";
|
|
67
|
+
dialoginner.style.height = "90%";
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var scriptbase = config.url_base + "/plugins/tui.image-editor/";
|
|
71
|
+
|
|
72
|
+
window.rte_image_editor_callback = function (win) {
|
|
73
|
+
console.log(win);
|
|
74
|
+
var options = {
|
|
75
|
+
includeUI: {
|
|
76
|
+
loadImage: {
|
|
77
|
+
path: img.src,
|
|
78
|
+
name: 'RteImage'
|
|
79
|
+
},
|
|
80
|
+
//locale: locale_ru_RU,
|
|
81
|
+
theme: {
|
|
82
|
+
// main icons
|
|
83
|
+
'menu.normalIcon.path': scriptbase + 'svg/icon-d.svg',
|
|
84
|
+
'menu.activeIcon.path': scriptbase + 'svg/icon-b.svg',
|
|
85
|
+
'menu.disabledIcon.path': scriptbase + 'svg/icon-a.svg',
|
|
86
|
+
'menu.hoverIcon.path': scriptbase + 'svg/icon-c.svg',
|
|
87
|
+
// submenu icons
|
|
88
|
+
'submenu.normalIcon.path': scriptbase + 'svg/icon-d.svg',
|
|
89
|
+
'submenu.normalIcon.name': 'icon-d',
|
|
90
|
+
'submenu.activeIcon.path': scriptbase + 'svg/icon-c.svg',
|
|
91
|
+
'submenu.activeIcon.name': 'icon-c'
|
|
92
|
+
},
|
|
93
|
+
//initMenu: 'filter',
|
|
94
|
+
menuBarPosition: 'bottom'
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
cssMaxWidth: 700,
|
|
98
|
+
cssMaxHeight: 500,
|
|
99
|
+
selectionStyle: {
|
|
100
|
+
cornerSize: 20,
|
|
101
|
+
rotatingPointOffset: 70
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var imgeditor = new win.tui.ImageEditor(win.document.querySelector('#tui-image-editor'), options);
|
|
105
|
+
|
|
106
|
+
var btns = win.document.querySelector('.tui-image-editor-header-buttons');
|
|
107
|
+
btns.innerHTML = '';
|
|
108
|
+
var savebtn = __Append(btns, "button", "");
|
|
109
|
+
savebtn.innerText = "Save";
|
|
110
|
+
savebtn.onclick = function () {
|
|
111
|
+
|
|
112
|
+
var dataurl = imgeditor.toDataURL();
|
|
113
|
+
if (!config.file_upload_handler) {
|
|
114
|
+
img.src = dataurl;
|
|
115
|
+
editor.notifySelectionChange();
|
|
116
|
+
dialoginner.close();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var file = dataURLToBlob(dataurl);
|
|
121
|
+
|
|
122
|
+
config.file_upload_handler(file, function (url, error) {
|
|
123
|
+
if (url) {
|
|
124
|
+
img.src = url;
|
|
125
|
+
editor.notifySelectionChange();
|
|
126
|
+
dialoginner.close();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (error) {
|
|
130
|
+
//TODO:retry dialog or cancel
|
|
131
|
+
alert("upload failed , TODO:show retry dialog or cancel");
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
alert("Developer warning : ");
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
iframe = __Append(dialoginner, "iframe", "align-self:center;flex:99;width:100%;height:100%px;border:0px;", "rte-editable");
|
|
144
|
+
iframe.contentDocument.open("text/html");
|
|
145
|
+
iframe.contentDocument.write("<html><head><base href='" + editor.htmlEncode(location.href) + "'/>"
|
|
146
|
+
+ "<link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(scriptbase + "tui-color-picker.min.css") + "'/>"
|
|
147
|
+
+ "<link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(scriptbase + "tui-image-editor.min.css") + "'/>"
|
|
148
|
+
+ "<script src='" + editor.htmlEncode(scriptbase + "fabric.min.js") + "'></script>"
|
|
149
|
+
+ "<script src='" + editor.htmlEncode(scriptbase + "tui-color-picker.min.js") + "'></script>"
|
|
150
|
+
+ "<script src='" + editor.htmlEncode(scriptbase + "tui-code-snippet.min.js") + "'></script>"
|
|
151
|
+
+ "<script src='" + editor.htmlEncode(scriptbase + "tui-image-editor.min.js") + "'></script>"
|
|
152
|
+
+ "</head><body style='padding:10px;margin:0px'><div id='tui-image-editor'></div></body>"
|
|
153
|
+
+ "<script>window.onload=function(){setTimeout(function(){parent.rte_image_editor_callback(window)},100)}</script></html>")
|
|
154
|
+
iframe.contentDocument.close();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|