| 1 |
!(function () { |
| 2 |
'use strict'; |
| 3 |
var t = tinymce.util.Tools.resolve('tinymce.PluginManager'), |
| 4 |
n = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'), |
| 5 |
o = function (t) { |
| 6 |
return t.getParam('code_dialog_width', 600); |
| 7 |
}, |
| 8 |
i = function (t) { |
| 9 |
return t.getParam('code_dialog_height', Math.min(n.DOM.getViewPort().h - 200, 500)); |
| 10 |
}, |
| 11 |
c = function (t, n) { |
| 12 |
t.focus(), |
| 13 |
t.undoManager.transact(function () { |
| 14 |
t.setContent(n); |
| 15 |
}), |
| 16 |
t.selection.setCursorLocation(), |
| 17 |
t.nodeChanged(); |
| 18 |
}, |
| 19 |
d = function (t) { |
| 20 |
return t.getContent({ source_view: !0 }); |
| 21 |
}, |
| 22 |
e = function (n) { |
| 23 |
var t = o(n), |
| 24 |
e = i(n); |
| 25 |
n.windowManager |
| 26 |
.open({ |
| 27 |
title: 'Source code', |
| 28 |
body: { |
| 29 |
type: 'textbox', |
| 30 |
name: 'code', |
| 31 |
multiline: !0, |
| 32 |
minWidth: t, |
| 33 |
minHeight: e, |
| 34 |
spellcheck: !1, |
| 35 |
style: 'direction: ltr; text-align: left', |
| 36 |
}, |
| 37 |
onSubmit: function (t) { |
| 38 |
c(n, t.data.code); |
| 39 |
}, |
| 40 |
}) |
| 41 |
.find('#code') |
| 42 |
.value(d(n)); |
| 43 |
}, |
| 44 |
u = function (t) { |
| 45 |
t.addCommand('mceCodeEditor', function () { |
| 46 |
e(t); |
| 47 |
}); |
| 48 |
}, |
| 49 |
a = function (t) { |
| 50 |
t.addButton('code', { |
| 51 |
icon: 'code', |
| 52 |
tooltip: 'Source code', |
| 53 |
onclick: function () { |
| 54 |
e(t); |
| 55 |
}, |
| 56 |
}), |
| 57 |
t.addMenuItem('code', { |
| 58 |
icon: 'code', |
| 59 |
text: 'Source code', |
| 60 |
onclick: function () { |
| 61 |
e(t); |
| 62 |
}, |
| 63 |
}); |
| 64 |
}; |
| 65 |
t.add('code', function (t) { |
| 66 |
return u(t), a(t), {}; |
| 67 |
}); |
| 68 |
})(); |
| 69 |
|