xmt_froala 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/xmt_froala.js +31 -0
- data/app/assets/stylesheets/xmt_froala.css +17 -0
- data/app/controllers/xmt_froala/application_controller.rb +5 -0
- data/app/controllers/xmt_froala/assets_controller.rb +94 -0
- data/app/models/xmt_froala/asset_uploader.rb +107 -0
- data/app/models/xmt_froala/file_uploader.rb +10 -0
- data/app/models/xmt_froala/flash_uploader.rb +10 -0
- data/app/models/xmt_froala/image_uploader.rb +10 -0
- data/app/models/xmt_froala/media_uploader.rb +10 -0
- data/config/routes.rb +6 -0
- data/lib/generators/xmt_froala/install/USAGE +10 -0
- data/lib/generators/xmt_froala/install/install_generator.rb +23 -0
- data/lib/generators/xmt_froala/install/templates/application.js +17 -0
- data/lib/generators/xmt_froala/install/templates/xmt_froala.rb +29 -0
- data/lib/generators/xmt_froala/migration/USAGE +14 -0
- data/lib/generators/xmt_froala/migration/migration_generator.rb +36 -0
- data/lib/generators/xmt_froala/migration/templates/migration/migration.rb +18 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/asset.rb +14 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/media.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/asset.rb +27 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/media.rb +3 -0
- data/lib/tasks/xmt_froala_tasks.rake +9 -0
- data/lib/xmt_froala.rb +65 -0
- data/lib/xmt_froala/active_record.rb +14 -0
- data/lib/xmt_froala/engine.rb +32 -0
- data/lib/xmt_froala/formtastic.rb +12 -0
- data/lib/xmt_froala/helper.rb +105 -0
- data/lib/xmt_froala/simple_form.rb +11 -0
- data/lib/xmt_froala/version.rb +3 -0
- data/vendor/assets/javascripts/xmt_froala/froala_editor.js +0 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ar.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/bs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/cs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/da.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/de.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_ca.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_gb.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/es.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/et.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fa.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fi.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/he.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hu.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/id.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/it.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ja.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ko.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/me.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nb.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_br.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_pt.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ro.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ru.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sv.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/th.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/tr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/uk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/vi.js +258 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_cn.js +320 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_tw.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.js +139 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.js +154 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.js +3270 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.js +393 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.js +492 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.js +459 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.js +509 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.js +121 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.js +736 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.min.js +239 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.js +182 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.js +118 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.js +430 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.js +274 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.js +216 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.js +3323 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.js +1056 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.js +94 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.js +537 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.js +1157 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.js +462 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.js +290 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.js +144 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/plain_paste.js +96 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.js +137 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_format.js +89 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.js +478 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.js +141 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.js +189 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.js +781 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.js +4194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.js +194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.js +2342 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.js +1403 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.js +543 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.js +163 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.js +222 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/xmt_froala.js +15172 -0
- data/vendor/assets/stylesheets/xmt_froala/css/font-awesome.css +2546 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.css +2902 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.css +413 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.css +57 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.css +112 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.css +155 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.css +43 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.css +42 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.css +146 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.css +28 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.css +52 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.css +244 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.css +266 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.css +37 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.css +70 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.css +51 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.css +181 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.css +231 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.css +64 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.css +72 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/xmt_froala.css +1423 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.svg +2671 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff2 +0 -0
- metadata +273 -0
@@ -0,0 +1,239 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
!function (i) {
|
8
|
+
"function" == typeof define && define.amd ? define(["jquery"], i) : "object" == typeof module && module.exports ? module.exports = function (e, t) {
|
9
|
+
return t === undefined && (t = "undefined" != typeof window ? require("jquery") : require("jquery")(e)), i(t)
|
10
|
+
} : i(window.jQuery)
|
11
|
+
}(function (C) {
|
12
|
+
C.extend(C.FE.POPUP_TEMPLATES, {"file.insert": "[_BUTTONS_][_UPLOAD_LAYER_][_PROGRESS_BAR_]"}), C.extend(C.FE.DEFAULTS, {
|
13
|
+
fileUpload: !0,
|
14
|
+
fileUploadURL: "https://i.froala.com/upload",
|
15
|
+
fileUploadParam: "file",
|
16
|
+
fileUploadParams: {},
|
17
|
+
fileUploadToS3: !1,
|
18
|
+
fileUploadMethod: "POST",
|
19
|
+
fileMaxSize: 10485760,
|
20
|
+
fileAllowedTypes: ["*"],
|
21
|
+
fileInsertButtons: ["fileBack", "|"],
|
22
|
+
fileUseSelectedText: !1
|
23
|
+
}), C.FE.PLUGINS.file = function (l) {
|
24
|
+
var r, f = 2, p = 3, d = 4, s = 5, u = 6, i = {};
|
25
|
+
|
26
|
+
function c() {
|
27
|
+
var e = l.popups.get("file.insert");
|
28
|
+
e || (e = S()), e.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"), e.find(".fr-file-progress-bar-layer").addClass("fr-active"), e.find(".fr-buttons").hide(), n(l.language.translate("Uploading"), 0)
|
29
|
+
}
|
30
|
+
|
31
|
+
function o(e) {
|
32
|
+
var t = l.popups.get("file.insert");
|
33
|
+
t && (t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"), t.find(".fr-file-progress-bar-layer").removeClass("fr-active"), t.find(".fr-buttons").show(), e && (l.events.focus(), l.popups.hide("file.insert")))
|
34
|
+
}
|
35
|
+
|
36
|
+
function n(e, t) {
|
37
|
+
var i = l.popups.get("file.insert");
|
38
|
+
if (i) {
|
39
|
+
var r = i.find(".fr-file-progress-bar-layer");
|
40
|
+
r.find("h3").text(e + (t ? " " + t + "%" : "")), r.removeClass("fr-error"), t ? (r.find("div").removeClass("fr-indeterminate"), r.find("div > span").css("width", t + "%")) : r.find("div").addClass("fr-indeterminate")
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function v(e, t, i) {
|
45
|
+
l.edit.on(), l.events.focus(!0), l.selection.restore(), l.opts.fileUseSelectedText && l.selection.text().length && (t = l.selection.text()), l.html.insert('<a href="' + e + '" target="_blank" id="fr-inserted-file" class="fr-file">' + t + "</a>");
|
46
|
+
var r = l.$el.find("#fr-inserted-file");
|
47
|
+
r.removeAttr("id"), l.popups.hide("file.insert"), l.undo.saveStep(), E(), l.events.trigger("file.inserted", [r, i])
|
48
|
+
}
|
49
|
+
|
50
|
+
function g(e) {
|
51
|
+
var t = this.status, i = this.response, r = this.responseXML, o = this.responseText;
|
52
|
+
try {
|
53
|
+
if (l.opts.fileUploadToS3) if (201 == t) {
|
54
|
+
var n = function (e) {
|
55
|
+
try {
|
56
|
+
var t = C(e).find("Location").text(), i = C(e).find("Key").text();
|
57
|
+
return !1 === l.events.trigger("file.uploadedToS3", [t, i, e], !0) ? (l.edit.on(), !1) : t
|
58
|
+
} catch (r) {
|
59
|
+
return b(d, e), !1
|
60
|
+
}
|
61
|
+
}(r);
|
62
|
+
n && v(n, e, i || r)
|
63
|
+
} else b(d, i || r); else if (200 <= t && t < 300) {
|
64
|
+
var a = function (e) {
|
65
|
+
try {
|
66
|
+
if (!1 === l.events.trigger("file.uploaded", [e], !0)) return l.edit.on(), !1;
|
67
|
+
var t = JSON.parse(e);
|
68
|
+
return t.link ? t : (b(f, e), !1)
|
69
|
+
} catch (i) {
|
70
|
+
return b(d, e), !1
|
71
|
+
}
|
72
|
+
}(o);
|
73
|
+
a && v(a.link, e, i || o)
|
74
|
+
} else b(p, i || o)
|
75
|
+
} catch (s) {
|
76
|
+
b(d, i || o)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
function h() {
|
81
|
+
b(d, this.response || this.responseText || this.responseXML)
|
82
|
+
}
|
83
|
+
|
84
|
+
function m(e) {
|
85
|
+
if (e.lengthComputable) {
|
86
|
+
var t = e.loaded / e.total * 100 | 0;
|
87
|
+
n(l.language.translate("Uploading"), t)
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
function b(e, t) {
|
92
|
+
l.edit.on(), function (e) {
|
93
|
+
c();
|
94
|
+
var t = l.popups.get("file.insert").find(".fr-file-progress-bar-layer");
|
95
|
+
t.addClass("fr-error");
|
96
|
+
var i = t.find("h3");
|
97
|
+
i.text(e), l.events.disableBlur(), i.focus()
|
98
|
+
}(l.language.translate("Something went wrong. Please try again.")), l.events.trigger("file.error", [{
|
99
|
+
code: e,
|
100
|
+
message: i[e]
|
101
|
+
}, t])
|
102
|
+
}
|
103
|
+
|
104
|
+
function y() {
|
105
|
+
l.edit.on(), o(!0)
|
106
|
+
}
|
107
|
+
|
108
|
+
function a(e) {
|
109
|
+
if (void 0 !== e && 0 < e.length) {
|
110
|
+
if (!1 === l.events.trigger("file.beforeUpload", [e])) return !1;
|
111
|
+
var t, i = e[0];
|
112
|
+
if (i.size > l.opts.fileMaxSize) return b(s), !1;
|
113
|
+
if (l.opts.fileAllowedTypes.indexOf("*") < 0 && l.opts.fileAllowedTypes.indexOf(i.type.replace(/file\//g, "")) < 0) return b(u), !1;
|
114
|
+
if (l.drag_support.formdata && (t = l.drag_support.formdata ? new FormData : null), t) {
|
115
|
+
var r;
|
116
|
+
if (!1 !== l.opts.fileUploadToS3) for (r in t.append("key", l.opts.fileUploadToS3.keyStart + (new Date).getTime() + "-" + (i.name || "untitled")), t.append("success_action_status", "201"), t.append("X-Requested-With", "xhr"), t.append("Content-Type", i.type), l.opts.fileUploadToS3.params) l.opts.fileUploadToS3.params.hasOwnProperty(r) && t.append(r, l.opts.fileUploadToS3.params[r]);
|
117
|
+
for (r in l.opts.fileUploadParams) l.opts.fileUploadParams.hasOwnProperty(r) && t.append(r, l.opts.fileUploadParams[r]);
|
118
|
+
t.append(l.opts.fileUploadParam, i);
|
119
|
+
var o = l.opts.fileUploadURL;
|
120
|
+
l.opts.fileUploadToS3 && (o = l.opts.fileUploadToS3.uploadURL ? l.opts.fileUploadToS3.uploadURL : "https://" + l.opts.fileUploadToS3.region + ".amazonaws.com/" + l.opts.fileUploadToS3.bucket);
|
121
|
+
var n = l.core.getXHR(o, l.opts.fileUploadMethod);
|
122
|
+
n.onload = function () {
|
123
|
+
g.call(n, i.name)
|
124
|
+
}, n.onerror = h, n.upload.onprogress = m, n.onabort = y, c();
|
125
|
+
var a = l.popups.get("file.insert");
|
126
|
+
a && a.off("abortUpload").on("abortUpload", function () {
|
127
|
+
4 != n.readyState && n.abort()
|
128
|
+
}), n.send(t)
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
function U() {
|
134
|
+
o()
|
135
|
+
}
|
136
|
+
|
137
|
+
function S(e) {
|
138
|
+
if (e) return l.popups.onHide("file.insert", U), !0;
|
139
|
+
var t;
|
140
|
+
l.opts.fileUpload || l.opts.fileInsertButtons.splice(l.opts.fileInsertButtons.indexOf("fileUpload"), 1), t = '<div class="fr-buttons">' + l.button.buildList(l.opts.fileInsertButtons) + "</div>";
|
141
|
+
var i = "";
|
142
|
+
l.opts.fileUpload && (i = '<div class="fr-file-upload-layer fr-layer fr-active" id="fr-file-upload-layer-' + l.id + '"><strong>' + l.language.translate("Drop file") + "</strong><br>(" + l.language.translate("or click") + ')<div class="fr-form"><input type="file" name="' + l.opts.fileUploadParam + '" accept="/*" tabIndex="-1" aria-labelledby="fr-file-upload-layer-' + l.id + '" role="button"></div></div>');
|
143
|
+
var r, o = {
|
144
|
+
buttons: t,
|
145
|
+
upload_layer: i,
|
146
|
+
progress_bar: '<div class="fr-file-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="fileDismissError" tabIndex="2" role="button">OK</button></div></div>'
|
147
|
+
}, n = l.popups.create("file.insert", o);
|
148
|
+
return r = n, l.events.$on(r, "dragover dragenter", ".fr-file-upload-layer", function () {
|
149
|
+
return C(this).addClass("fr-drop"), !1
|
150
|
+
}, !0), l.events.$on(r, "dragleave dragend", ".fr-file-upload-layer", function () {
|
151
|
+
return C(this).removeClass("fr-drop"), !1
|
152
|
+
}, !0), l.events.$on(r, "drop", ".fr-file-upload-layer", function (e) {
|
153
|
+
e.preventDefault(), e.stopPropagation(), C(this).removeClass("fr-drop");
|
154
|
+
var t = e.originalEvent.dataTransfer;
|
155
|
+
t && t.files && (r.data("instance") || l).file.upload(t.files)
|
156
|
+
}, !0), l.helpers.isIOS() && l.events.$on(r, "touchstart", '.fr-file-upload-layer input[type="file"]', function () {
|
157
|
+
C(this).trigger("click")
|
158
|
+
}), l.events.$on(r, "change", '.fr-file-upload-layer input[type="file"]', function () {
|
159
|
+
this.files && (r.data("instance") || l).file.upload(this.files), C(this).val("")
|
160
|
+
}, !0), n
|
161
|
+
}
|
162
|
+
|
163
|
+
function e(e) {
|
164
|
+
l.node.hasClass(e, "fr-file")
|
165
|
+
}
|
166
|
+
|
167
|
+
function t(e) {
|
168
|
+
var t = e.originalEvent.dataTransfer;
|
169
|
+
if (t && t.files && t.files.length) {
|
170
|
+
var i = t.files[0];
|
171
|
+
if (i && "undefined" != typeof i.type) {
|
172
|
+
if (i.type.indexOf("image") < 0) {
|
173
|
+
if (!l.opts.fileUpload) return e.preventDefault(), e.stopPropagation(), !1;
|
174
|
+
l.markers.remove(), l.markers.insertAtPoint(e.originalEvent), l.$el.find(".fr-marker").replaceWith(C.FE.MARKERS), l.popups.hideAll();
|
175
|
+
var r = l.popups.get("file.insert");
|
176
|
+
return r || (r = S()), l.popups.setContainer("file.insert", l.$sc), l.popups.show("file.insert", e.originalEvent.pageX, e.originalEvent.pageY), c(), a(t.files), e.preventDefault(), e.stopPropagation(), !1
|
177
|
+
}
|
178
|
+
} else i.type.indexOf("image") < 0 && (e.preventDefault(), e.stopPropagation())
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
function E() {
|
183
|
+
var e, t = Array.prototype.slice.call(l.el.querySelectorAll("a.fr-file")), i = [];
|
184
|
+
for (e = 0; e < t.length; e++) i.push(t[e].getAttribute("href"));
|
185
|
+
if (r) for (e = 0; e < r.length; e++) i.indexOf(r[e].getAttribute("href")) < 0 && l.events.trigger("file.unlink", [r[e]]);
|
186
|
+
r = t
|
187
|
+
}
|
188
|
+
|
189
|
+
return i[1] = "File cannot be loaded from the passed link.", i[f] = "No link in upload response.", i[p] = "Error during file upload.", i[d] = "Parsing response failed.", i[s] = "File is too large.", i[u] = "File file type is invalid.", i[7] = "Files can be uploaded only to same domain in IE 8 and IE 9.", {
|
190
|
+
_init: function () {
|
191
|
+
l.events.on("drop", t), l.events.$on(l.$win, "keydown", function (e) {
|
192
|
+
var t = e.which, i = l.popups.get("file.insert");
|
193
|
+
i && t == C.FE.KEYCODE.ESC && i.trigger("abortUpload")
|
194
|
+
}), l.events.on("destroy", function () {
|
195
|
+
var e = l.popups.get("file.insert");
|
196
|
+
e && e.trigger("abortUpload")
|
197
|
+
}), l.events.on("link.beforeRemove", e), l.$wp && (E(), l.events.on("contentChanged", E)), S(!0)
|
198
|
+
}, showInsertPopup: function () {
|
199
|
+
var e = l.$tb.find('.fr-command[data-cmd="insertFile"]'), t = l.popups.get("file.insert");
|
200
|
+
if (t || (t = S()), o(), !t.hasClass("fr-active")) if (l.popups.refresh("file.insert"), l.popups.setContainer("file.insert", l.$tb), e.is(":visible")) {
|
201
|
+
var i = e.offset().left + e.outerWidth() / 2,
|
202
|
+
r = e.offset().top + (l.opts.toolbarBottom ? 10 : e.outerHeight() - 10);
|
203
|
+
l.popups.show("file.insert", i, r, e.outerHeight())
|
204
|
+
} else l.position.forSelection(t), l.popups.show("file.insert")
|
205
|
+
}, upload: a, insert: v, back: function () {
|
206
|
+
l.events.disableBlur(), l.selection.restore(), l.events.enableBlur(), l.popups.hide("file.insert"), l.toolbar.showInline()
|
207
|
+
}, hideProgressBar: o
|
208
|
+
}
|
209
|
+
}, C.FE.DefineIcon("insertFile", {
|
210
|
+
NAME: "file-o",
|
211
|
+
FA5NAME: "file"
|
212
|
+
}), C.FE.RegisterCommand("insertFile", {
|
213
|
+
title: "Upload File",
|
214
|
+
undo: !1,
|
215
|
+
focus: !0,
|
216
|
+
refreshAfterCallback: !1,
|
217
|
+
popup: !0,
|
218
|
+
callback: function () {
|
219
|
+
this.popups.isVisible("file.insert") ? (this.$el.find(".fr-marker").length && (this.events.disableBlur(), this.selection.restore()), this.popups.hide("file.insert")) : this.file.showInsertPopup()
|
220
|
+
},
|
221
|
+
plugin: "file"
|
222
|
+
}), C.FE.DefineIcon("fileBack", {NAME: "arrow-left"}), C.FE.RegisterCommand("fileBack", {
|
223
|
+
title: "Back",
|
224
|
+
undo: !1,
|
225
|
+
focus: !1,
|
226
|
+
back: !0,
|
227
|
+
refreshAfterCallback: !1,
|
228
|
+
callback: function () {
|
229
|
+
this.file.back()
|
230
|
+
},
|
231
|
+
refresh: function (e) {
|
232
|
+
this.opts.toolbarInline ? (e.removeClass("fr-hidden"), e.next(".fr-separator").removeClass("fr-hidden")) : (e.addClass("fr-hidden"), e.next(".fr-separator").addClass("fr-hidden"))
|
233
|
+
}
|
234
|
+
}), C.FE.RegisterCommand("fileDismissError", {
|
235
|
+
title: "OK", callback: function () {
|
236
|
+
this.file.hideProgressBar(!0)
|
237
|
+
}
|
238
|
+
})
|
239
|
+
});
|
@@ -0,0 +1,182 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function (factory) {
|
8
|
+
if (typeof define === 'function' && define.amd) {
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define(['jquery'], factory);
|
11
|
+
} else if (typeof module === 'object' && module.exports) {
|
12
|
+
// Node/CommonJS
|
13
|
+
module.exports = function( root, jQuery ) {
|
14
|
+
if ( jQuery === undefined ) {
|
15
|
+
// require('jQuery') returns a factory that requires window to
|
16
|
+
// build a jQuery instance, we normalize how we use modules
|
17
|
+
// that require this pattern but the window provided is a noop
|
18
|
+
// if it's defined (how jquery works)
|
19
|
+
if ( typeof window !== 'undefined' ) {
|
20
|
+
jQuery = require('jquery');
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
jQuery = require('jquery')(root);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return factory(jQuery);
|
27
|
+
};
|
28
|
+
} else {
|
29
|
+
// Browser globals
|
30
|
+
factory(window.jQuery);
|
31
|
+
}
|
32
|
+
}(function ($) {
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
$.extend($.FE.DEFAULTS, {
|
37
|
+
fontFamily: {
|
38
|
+
'Arial,Helvetica,sans-serif': 'Arial',
|
39
|
+
'Georgia,serif': 'Georgia',
|
40
|
+
'Impact,Charcoal,sans-serif': 'Impact',
|
41
|
+
'Tahoma,Geneva,sans-serif': 'Tahoma',
|
42
|
+
'Times New Roman,Times,serif,-webkit-standard': 'Times New Roman',
|
43
|
+
'Verdana,Geneva,sans-serif': 'Verdana'
|
44
|
+
},
|
45
|
+
fontFamilySelection: false,
|
46
|
+
fontFamilyDefaultSelection: 'Font Family'
|
47
|
+
})
|
48
|
+
|
49
|
+
$.FE.PLUGINS.fontFamily = function (editor) {
|
50
|
+
function apply (val) {
|
51
|
+
editor.format.applyStyle('font-family', val);
|
52
|
+
}
|
53
|
+
|
54
|
+
function refreshOnShow($btn, $dropdown) {
|
55
|
+
$dropdown.find('.fr-command.fr-active').removeClass('fr-active').attr('aria-selected', false);
|
56
|
+
$dropdown.find('.fr-command[data-param1="' + _getSelection() + '"]').addClass('fr-active').attr('aria-selected', true);
|
57
|
+
|
58
|
+
var $list = $dropdown.find('.fr-dropdown-list');
|
59
|
+
var $active = $dropdown.find('.fr-active').parent();
|
60
|
+
|
61
|
+
if ($active.length) {
|
62
|
+
$list.parent().scrollTop($active.offset().top - $list.offset().top - ($list.parent().outerHeight() / 2 - $active.outerHeight() / 2));
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
$list.parent().scrollTop(0);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
function _getArray (val) {
|
70
|
+
var font_array = val.replace(/(sans-serif|serif|monospace|cursive|fantasy)/gi, '').replace(/"|'| /g, '').split(',');
|
71
|
+
|
72
|
+
return $.grep(font_array, function (txt) { return txt.length > 0 });
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Return first match position.
|
77
|
+
*/
|
78
|
+
function _matches (array1, array2) {
|
79
|
+
for (var i = 0; i < array1.length; i++) {
|
80
|
+
for (var j = 0; j < array2.length; j++) {
|
81
|
+
if (array1[i].toLowerCase() == array2[j].toLowerCase()) {
|
82
|
+
return [i, j];
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
return null;
|
88
|
+
}
|
89
|
+
|
90
|
+
function _getSelection () {
|
91
|
+
var val = $(editor.selection.element()).css('font-family');
|
92
|
+
var font_array = _getArray(val);
|
93
|
+
|
94
|
+
var font_matches = [];
|
95
|
+
|
96
|
+
for (var key in editor.opts.fontFamily) {
|
97
|
+
if (editor.opts.fontFamily.hasOwnProperty(key)) {
|
98
|
+
var c_font_array = _getArray(key);
|
99
|
+
|
100
|
+
var match = _matches(font_array, c_font_array);
|
101
|
+
|
102
|
+
if (match) {
|
103
|
+
font_matches.push([key, match]);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
if (font_matches.length === 0) return null;
|
109
|
+
|
110
|
+
// Sort matches by their position.
|
111
|
+
// Times,Arial should be detected as being Times, not Arial.
|
112
|
+
font_matches.sort(function (a, b) {
|
113
|
+
var f_diff = a[1][0] - b[1][0];
|
114
|
+
|
115
|
+
if (f_diff === 0) {
|
116
|
+
return a[1][1] - b[1][1];
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
return f_diff;
|
120
|
+
}
|
121
|
+
});
|
122
|
+
|
123
|
+
return font_matches[0][0];
|
124
|
+
}
|
125
|
+
|
126
|
+
function refresh ($btn) {
|
127
|
+
if (editor.opts.fontFamilySelection) {
|
128
|
+
var val = $(editor.selection.element()).css('font-family').replace(/(sans-serif|serif|monospace|cursive|fantasy)/gi, '').replace(/"|'|/g, '').split(',');
|
129
|
+
|
130
|
+
$btn.find('> span').text(editor.opts.fontFamily[_getSelection()] || val[0] || editor.language.translate(editor.opts.fontFamilyDefaultSelection));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
return {
|
135
|
+
apply: apply,
|
136
|
+
refreshOnShow: refreshOnShow,
|
137
|
+
refresh: refresh
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
// Register the font size command.
|
142
|
+
$.FE.RegisterCommand('fontFamily', {
|
143
|
+
type: 'dropdown',
|
144
|
+
displaySelection: function (editor) {
|
145
|
+
return editor.opts.fontFamilySelection;
|
146
|
+
},
|
147
|
+
defaultSelection: function (editor) {
|
148
|
+
return editor.opts.fontFamilyDefaultSelection;
|
149
|
+
},
|
150
|
+
displaySelectionWidth: 120,
|
151
|
+
html: function () {
|
152
|
+
var c = '<ul class="fr-dropdown-list" role="presentation">';
|
153
|
+
var options = this.opts.fontFamily;
|
154
|
+
|
155
|
+
for (var val in options) {
|
156
|
+
if (options.hasOwnProperty(val)) {
|
157
|
+
c += '<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="fontFamily" data-param1="' + val + '" style="font-family: ' + val + '" title="' + options[val] + '">' + options[val] + '</a></li>';
|
158
|
+
}
|
159
|
+
}
|
160
|
+
c += '</ul>';
|
161
|
+
|
162
|
+
return c;
|
163
|
+
},
|
164
|
+
title: 'Font Family',
|
165
|
+
callback: function (cmd, val) {
|
166
|
+
this.fontFamily.apply(val);
|
167
|
+
},
|
168
|
+
refresh: function ($btn) {
|
169
|
+
this.fontFamily.refresh($btn);
|
170
|
+
},
|
171
|
+
refreshOnShow: function ($btn, $dropdown) {
|
172
|
+
this.fontFamily.refreshOnShow($btn, $dropdown);
|
173
|
+
},
|
174
|
+
plugin: 'fontFamily'
|
175
|
+
})
|
176
|
+
|
177
|
+
// Add the font size icon.
|
178
|
+
$.FE.DefineIcon('fontFamily', {
|
179
|
+
NAME: 'font'
|
180
|
+
});
|
181
|
+
|
182
|
+
}));
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(l){l.extend(l.FE.DEFAULTS,{fontFamily:{"Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma","Times New Roman,Times,serif,-webkit-standard":"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},fontFamilySelection:!1,fontFamilyDefaultSelection:"Font Family"}),l.FE.PLUGINS.fontFamily=function(o){function i(e){var t=e.replace(/(sans-serif|serif|monospace|cursive|fantasy)/gi,"").replace(/"|'| /g,"").split(",");return l.grep(t,function(e){return 0<e.length})}function r(e,t){for(var n=0;n<e.length;n++)for(var a=0;a<t.length;a++)if(e[n].toLowerCase()==t[a].toLowerCase())return[n,a];return null}function f(){var e=i(l(o.selection.element()).css("font-family")),t=[];for(var n in o.opts.fontFamily)if(o.opts.fontFamily.hasOwnProperty(n)){var a=r(e,i(n));a&&t.push([n,a])}return 0===t.length?null:(t.sort(function(e,t){var n=e[1][0]-t[1][0];return 0===n?e[1][1]-t[1][1]:n}),t[0][0])}return{apply:function(e){o.format.applyStyle("font-family",e)},refreshOnShow:function(e,t){t.find(".fr-command.fr-active").removeClass("fr-active").attr("aria-selected",!1),t.find('.fr-command[data-param1="'+f()+'"]').addClass("fr-active").attr("aria-selected",!0);var n=t.find(".fr-dropdown-list"),a=t.find(".fr-active").parent();a.length?n.parent().scrollTop(a.offset().top-n.offset().top-(n.parent().outerHeight()/2-a.outerHeight()/2)):n.parent().scrollTop(0)},refresh:function(e){if(o.opts.fontFamilySelection){var t=l(o.selection.element()).css("font-family").replace(/(sans-serif|serif|monospace|cursive|fantasy)/gi,"").replace(/"|'|/g,"").split(",");e.find("> span").text(o.opts.fontFamily[f()]||t[0]||o.language.translate(o.opts.fontFamilyDefaultSelection))}}}},l.FE.RegisterCommand("fontFamily",{type:"dropdown",displaySelection:function(e){return e.opts.fontFamilySelection},defaultSelection:function(e){return e.opts.fontFamilyDefaultSelection},displaySelectionWidth:120,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.fontFamily;for(var n in t)t.hasOwnProperty(n)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="fontFamily" data-param1="'+n+'" style="font-family: '+n+'" title="'+t[n]+'">'+t[n]+"</a></li>");return e+="</ul>"},title:"Font Family",callback:function(e,t){this.fontFamily.apply(t)},refresh:function(e){this.fontFamily.refresh(e)},refreshOnShow:function(e,t){this.fontFamily.refreshOnShow(e,t)},plugin:"fontFamily"}),l.FE.DefineIcon("fontFamily",{NAME:"font"})});
|
@@ -0,0 +1,118 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function (factory) {
|
8
|
+
if (typeof define === 'function' && define.amd) {
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define(['jquery'], factory);
|
11
|
+
} else if (typeof module === 'object' && module.exports) {
|
12
|
+
// Node/CommonJS
|
13
|
+
module.exports = function( root, jQuery ) {
|
14
|
+
if ( jQuery === undefined ) {
|
15
|
+
// require('jQuery') returns a factory that requires window to
|
16
|
+
// build a jQuery instance, we normalize how we use modules
|
17
|
+
// that require this pattern but the window provided is a noop
|
18
|
+
// if it's defined (how jquery works)
|
19
|
+
if ( typeof window !== 'undefined' ) {
|
20
|
+
jQuery = require('jquery');
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
jQuery = require('jquery')(root);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return factory(jQuery);
|
27
|
+
};
|
28
|
+
} else {
|
29
|
+
// Browser globals
|
30
|
+
factory(window.jQuery);
|
31
|
+
}
|
32
|
+
}(function ($) {
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
$.extend($.FE.DEFAULTS, {
|
37
|
+
fontSize: ['8', '9', '10', '11', '12', '14', '18', '24', '30', '36', '48', '60', '72', '96'],
|
38
|
+
fontSizeSelection: false,
|
39
|
+
fontSizeDefaultSelection: '12',
|
40
|
+
fontSizeUnit: 'px'
|
41
|
+
});
|
42
|
+
|
43
|
+
$.FE.PLUGINS.fontSize = function (editor) {
|
44
|
+
function apply (val) {
|
45
|
+
editor.format.applyStyle('font-size', val);
|
46
|
+
}
|
47
|
+
|
48
|
+
function refreshOnShow($btn, $dropdown) {
|
49
|
+
var val = $(editor.selection.element()).css('font-size');
|
50
|
+
$dropdown.find('.fr-command.fr-active').removeClass('fr-active').attr('aria-selected', false);
|
51
|
+
$dropdown.find('.fr-command[data-param1="' + val + '"]').addClass('fr-active').attr('aria-selected', true);
|
52
|
+
|
53
|
+
var $list = $dropdown.find('.fr-dropdown-list');
|
54
|
+
var $active = $dropdown.find('.fr-active').parent();
|
55
|
+
|
56
|
+
if ($active.length) {
|
57
|
+
$list.parent().scrollTop($active.offset().top - $list.offset().top - ($list.parent().outerHeight() / 2 - $active.outerHeight() / 2));
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
$list.parent().scrollTop(0);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
function refresh ($btn) {
|
65
|
+
if (editor.opts.fontSizeSelection) {
|
66
|
+
var val = editor.helpers.getPX($(editor.selection.element()).css('font-size'));
|
67
|
+
$btn.find('> span').text(val);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
return {
|
72
|
+
apply: apply,
|
73
|
+
refreshOnShow: refreshOnShow,
|
74
|
+
refresh: refresh
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
// Register the font size command.
|
79
|
+
$.FE.RegisterCommand('fontSize', {
|
80
|
+
type: 'dropdown',
|
81
|
+
title: 'Font Size',
|
82
|
+
displaySelection: function (editor) {
|
83
|
+
return editor.opts.fontSizeSelection;
|
84
|
+
},
|
85
|
+
displaySelectionWidth: 30,
|
86
|
+
defaultSelection: function (editor) {
|
87
|
+
return editor.opts.fontSizeDefaultSelection;
|
88
|
+
},
|
89
|
+
html: function () {
|
90
|
+
var c = '<ul class="fr-dropdown-list" role="presentation">';
|
91
|
+
var options = this.opts.fontSize;
|
92
|
+
|
93
|
+
for (var i = 0; i < options.length; i++) {
|
94
|
+
var val = options[i];
|
95
|
+
c += '<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="fontSize" data-param1="' + val + this.opts.fontSizeUnit + '" title="' + val + '">' + val + '</a></li>';
|
96
|
+
}
|
97
|
+
c += '</ul>';
|
98
|
+
|
99
|
+
return c;
|
100
|
+
},
|
101
|
+
callback: function (cmd, val) {
|
102
|
+
this.fontSize.apply(val);
|
103
|
+
},
|
104
|
+
refresh: function ($btn) {
|
105
|
+
this.fontSize.refresh($btn);
|
106
|
+
},
|
107
|
+
refreshOnShow: function ($btn, $dropdown) {
|
108
|
+
this.fontSize.refreshOnShow($btn, $dropdown);
|
109
|
+
},
|
110
|
+
plugin: 'fontSize'
|
111
|
+
})
|
112
|
+
|
113
|
+
// Add the font size icon.
|
114
|
+
$.FE.DefineIcon('fontSize', {
|
115
|
+
NAME: 'text-height'
|
116
|
+
});
|
117
|
+
|
118
|
+
}));
|