91 lines
5.3 KiB
JavaScript
91 lines
5.3 KiB
JavaScript
! function() {
|
|
tinymce.PluginManager.add("bs_images", function(a, b) {
|
|
function c() {
|
|
a.undoManager.transact(function() {
|
|
a.execCommand("mceImage")
|
|
})
|
|
}
|
|
var d = (tinymce.dom.DomQuery, tinymce.util.Tools.each),
|
|
e = (tinymce.Env, [b + "/assets/css/plugin.min.css"]);
|
|
if ("object" == typeof a.settings.bs_images) var f = a.settings.bs_images;
|
|
var g = !0;
|
|
if ("object" == typeof f ? ("undefined" != typeof f.css ? f.css.exist ? 1 == window.galau_ui_debug && console.log("label => css: exist") : f.css.external ? (e.push(f.css.external), 1 == window.galau_ui_debug && console.log("label => css: external")) : (e.push(b + "/assets/css/bootstrap.min.css"), 1 == window.galau_ui_debug && console.log("label => css: internal")) : (e.push(b + "/assets/css/bootstrap.min.css"), 1 == window.galau_ui_debug && console.log("label => css: internal")), g = f.toolbar_text ? !0 : !1) : (e.push(b + "/assets/css/bootstrap.min.css"), 1 == window.galau_ui_debug && console.log("label => css: internal")), "undefined" != typeof a.settings.content_css)
|
|
if ("function" == typeof a.settings.content_css.push)
|
|
for (var h = 0; h < e.length; h++) a.settings.content_css.push(e[h]);
|
|
else if ("string" == typeof a.settings.content_css) {
|
|
a.settings.content_css = [a.settings.content_css];
|
|
for (var h = 0; h < e.length; h++) a.settings.content_css.push(e[h])
|
|
} else a.settings.content_css = e;
|
|
else a.settings.content_css = e;
|
|
"undefined" == typeof a.settings.extended_valid_elements && (a.settings.extended_valid_elements = "*[*]"), "undefined" == typeof a.settings.valid_elements && (a.settings.valid_elements = "*[*]"), 1 == window.galau_ui_debug && (console.log("images => valid: ", a.settings.valid_elements), console.log("images => extended_valid: ", a.settings.extended_valid_elements)), a.on("init", function() {
|
|
if (document.createStyleSheet)
|
|
for (var b = 0; b < e.length; b++) document.createStyleSheet(e[b]);
|
|
else
|
|
for (var b = 0; b < e.length; b++) cssLink = a.dom.create("link", {
|
|
rel: "stylesheet",
|
|
href: e[b]
|
|
}), document.getElementsByTagName("head")[0].appendChild(cssLink)
|
|
});
|
|
var i = "";
|
|
g && (i = " Images"), a.addButton("bs_images", {
|
|
icon: "guicon-image guicon guicon-image",
|
|
text: i,
|
|
type: "splitbutton",
|
|
tooltip: "Insert/edit images",
|
|
stateSelector: "img",
|
|
onclick: function() {
|
|
a.execCommand("mceImage")
|
|
},
|
|
menu: [{
|
|
text: "Thumbnail",
|
|
onclick: function() {
|
|
var b;
|
|
a.dom;
|
|
b = a.dom.getParent(a.selection.getStart(), "img"), 1 == window.galau_ui_debug && console.log("image => select : ", b), null == b ? a.undoManager.transact(function() {
|
|
a.execCommand("mceImage")
|
|
}) : (d("imgThumbnail imgCircle imgRounded".split(" "), function(b) {
|
|
a.formatter.remove(b)
|
|
}), a.formatter.apply("imgThumbnail"))
|
|
}
|
|
}, {
|
|
text: "Circle",
|
|
onclick: function() {
|
|
var b;
|
|
a.dom;
|
|
b = a.dom.getParent(a.selection.getStart(), "img"), 1 == window.galau_ui_debug && console.log("image => select : ", b), null == b ? a.undoManager.transact(function() {
|
|
a.execCommand("mceImage")
|
|
}) : (d("imgThumbnail imgCircle imgRounded".split(" "), function(b) {
|
|
a.formatter.remove(b)
|
|
}), a.formatter.apply("imgCircle"))
|
|
}
|
|
}, {
|
|
text: "Rounded",
|
|
onclick: function() {
|
|
var b;
|
|
a.dom;
|
|
b = a.dom.getParent(a.selection.getStart(), "img"), 1 == window.galau_ui_debug && console.log("image => select : ", b), null == b ? a.undoManager.transact(function() {
|
|
a.execCommand("mceImage")
|
|
}) : (d("imgThumbnail imgCircle imgRounded".split(" "), function(b) {
|
|
a.formatter.remove(b)
|
|
}), a.formatter.apply("imgRounded"))
|
|
}
|
|
}]
|
|
}), a.on("init", function() {
|
|
var b = a.settings.imagetools_toolbar;
|
|
b = b ? "bs_images |" + a.settings.imagetools_toolbar : "bs_images | rotateleft rotateright | flipv fliph | crop editimage imageoptions", 1 == window.galau_ui_debug && console.log("Image => toolbar: ", b), a.addContextToolbar("img", b), a.formatter.register({
|
|
imgThumbnail: {
|
|
selector: "img",
|
|
classes: "img-thumbnail"
|
|
},
|
|
imgCircle: {
|
|
selector: "img",
|
|
classes: "img-circle"
|
|
},
|
|
imgRounded: {
|
|
selector: "img",
|
|
classes: "img-rounded"
|
|
}
|
|
}), a.settings.image_advtab = !0, a.settings.image_class_list = tinymceproImgClassArray
|
|
}), a.settings.showGuiBootstrapImages || (a.settings.showGuiBootstrapImages = c)
|
|
})
|
|
}(); |