activeadmin_trumbowyg 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +7 -2
- data/app/assets/fonts/trumbowyg/icons.svg +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ar.js +67 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/bg.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/by.js +61 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.js +64 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/el.js +59 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/es.js +63 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/es_ar.js +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fi.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.js +66 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.min.js +3 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/he.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/hr.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/id.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.js +59 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ja.js +63 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.js +63 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.min.js +3 -4
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.js +59 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/mn.js +49 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/my.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.js +61 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/no_nb.js +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ph.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pl.js +55 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ro.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs.js +53 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs_latin.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.js +61 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sk.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.js +48 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.js +55 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.js +55 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ua.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.js +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_cn.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.js +66 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +162 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +34 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +29 -97
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +109 -35
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +30 -11
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +27 -15
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +1265 -877
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +1 -4
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +2 -5
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +95 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +257 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.js +182 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/sass/trumbowyg.giphy.scss +111 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.css +90 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +90 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +25 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +20 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +216 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +19 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +162 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +117 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +36 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +29 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +116 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +29 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +24 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +21 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.js +96 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +10 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +22 -3
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.js +20 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js +303 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +94 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js +79 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js +1 -0
- data/app/assets/{stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss → javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss} +11 -11
- data/app/assets/{stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css → javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css} +12 -12
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +346 -81
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss +46 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +36 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +32 -9
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +58 -23
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +427 -188
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg_input.js +17 -4
- data/app/assets/stylesheets/activeadmin/_trumbowyg_input.sass +11 -3
- data/app/assets/stylesheets/activeadmin/trumbowyg/{ui/sass/trumbowyg.scss → trumbowyg.scss} +44 -16
- data/lib/activeadmin/trumbowyg/version.rb +1 -1
- data/lib/tasks/trumbowyg.rake +21 -0
- metadata +230 -91
- data/.gitignore +0 -3
- data/Gemfile +0 -4
- data/activeadmin_trumbowyg.gemspec +0 -19
- data/app/assets/fonts/ui/icons.svg +0 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +0 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +0 -796
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +0 -584
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ar.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/bg.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/by.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ca.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/cs.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/da.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/de.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/el.min.js +0 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es_ar.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fa.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fi.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fr.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/he.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hr.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hu.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/id.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/it.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ja.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ko.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/mn.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/my.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/nl.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/no_nb.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ph.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pl.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt_br.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ro.min.js +0 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs_latin.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ru.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sk.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sv.min.js +0 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/tr.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ua.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/vi.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_cn.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_tw.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +0 -121
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +0 -179
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +0 -176
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +0 -49
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +0 -43
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +0 -2
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +0 -965
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +0 -2
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +0 -83
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +0 -101
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +0 -41
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +0 -123
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +0 -154
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +0 -58
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +0 -242
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.js +0 -1688
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.min.js +0 -2
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +0 -584
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
- data/screenshot.jpg +0 -0
@@ -1 +1 @@
|
|
1
|
-
!function(e){"use strict";var t={rows:
|
1
|
+
!function(e){"use strict";var t={rows:8,columns:8,styler:"table"};e.extend(!0,e.trumbowyg,{langs:{en:{table:"Insert table",tableAddRow:"Add row",tableAddRowAbove:"Add row above",tableAddColumnLeft:"Add column to the left",tableAddColumn:"Add column to the right",tableDeleteRow:"Delete row",tableDeleteColumn:"Delete column",tableDestroy:"Delete table",error:"Error"},da:{table:"Indsæt tabel",tableAddRow:"Tilføj række",tableAddRowAbove:"Tilføj række",tableAddColumnLeft:"Tilføj kolonne",tableAddColumn:"Tilføj kolonne",tableDeleteRow:"Slet række",tableDeleteColumn:"Slet kolonne",tableDestroy:"Slet tabel",error:"Fejl"},de:{table:"Tabelle einfügen",tableAddRow:"Zeile hinzufügen",tableAddRowAbove:"Zeile hinzufügen",tableAddColumnLeft:"Spalte hinzufügen",tableAddColumn:"Spalte hinzufügen",tableDeleteRow:"Zeile löschen",tableDeleteColumn:"Spalte löschen",tableDestroy:"Tabelle löschen",error:"Error"},sk:{table:"Vytvoriť tabuľky",tableAddRow:"Pridať riadok",tableAddRowAbove:"Pridať riadok",tableAddColumnLeft:"Pridať stĺpec",tableAddColumn:"Pridať stĺpec",error:"Chyba"},fr:{table:"Insérer un tableau",tableAddRow:"Ajouter des lignes",tableAddRowAbove:"Ajouter des lignes",tableAddColumnLeft:"Ajouter des colonnes",tableAddColumn:"Ajouter des colonnes",tableDeleteRow:"Effacer la ligne",tableDeleteColumn:"Effacer la colonne",tableDestroy:"Effacer le tableau",error:"Erreur"},cs:{table:"Vytvořit příkaz Table",tableAddRow:"Přidat řádek",tableAddRowAbove:"Přidat řádek",tableAddColumnLeft:"Přidat sloupec",tableAddColumn:"Přidat sloupec",error:"Chyba"},ru:{table:"Вставить таблицу",tableAddRow:"Добавить строку",tableAddRowAbove:"Добавить строку",tableAddColumnLeft:"Добавить столбец",tableAddColumn:"Добавить столбец",tableDeleteRow:"Удалить строку",tableDeleteColumn:"Удалить столбец",tableDestroy:"Удалить таблицу",error:"Ошибка"},ja:{table:"表の挿入",tableAddRow:"行の追加",tableAddRowAbove:"行の追加",tableAddColumnLeft:"列の追加",tableAddColumn:"列の追加",error:"エラー"},tr:{table:"Tablo ekle",tableAddRow:"Satır ekle",tableAddRowAbove:"Satır ekle",tableAddColumnLeft:"Kolon ekle",tableAddColumn:"Kolon ekle",error:"Hata"},zh_tw:{table:"插入表格",tableAddRow:"加入行",tableAddRowAbove:"加入行",tableAddColumnLeft:"加入列",tableAddColumn:"加入列",tableDeleteRow:"刪除行",tableDeleteColumn:"刪除列",tableDestroy:"刪除表格",error:"錯誤"},id:{table:"Sisipkan tabel",tableAddRow:"Sisipkan baris",tableAddRowAbove:"Sisipkan baris",tableAddColumnLeft:"Sisipkan kolom",tableAddColumn:"Sisipkan kolom",tableDeleteRow:"Hapus baris",tableDeleteColumn:"Hapus kolom",tableDestroy:"Hapus tabel",error:"Galat"},pt_br:{table:"Inserir tabela",tableAddRow:"Adicionar linha",tableAddRowAbove:"Adicionar linha",tableAddColumnLeft:"Adicionar coluna",tableAddColumn:"Adicionar coluna",tableDeleteRow:"Deletar linha",tableDeleteColumn:"Deletar coluna",tableDestroy:"Deletar tabela",error:"Erro"},ko:{table:"표 넣기",tableAddRow:"줄 추가",tableAddRowAbove:"줄 추가",tableAddColumnLeft:"칸 추가",tableAddColumn:"칸 추가",tableDeleteRow:"줄 삭제",tableDeleteColumn:"칸 삭제",tableDestroy:"표 지우기",error:"에러"}},plugins:{table:{init:function(l){l.o.plugins.table=e.extend(!0,{},t,l.o.plugins.table||{});var o={fn:function(){l.saveRange();var t="table",o=l.o.prefix+"dropdown",n={"class":o+"-"+t+" "+o+" "+l.o.prefix+"fixed-top"};n["data-"+o]=t;var b=e("<div/>",n);if(0===l.$box.find("."+o+"-"+t).length?l.$box.append(b.hide()):b=l.$box.find("."+o+"-"+t),b.html(""),l.$box.find("."+l.o.prefix+"table-button").hasClass(l.o.prefix+"active-button"))b.append(l.buildSubBtn("tableAddRowAbove")),b.append(l.buildSubBtn("tableAddRow")),b.append(l.buildSubBtn("tableAddColumnLeft")),b.append(l.buildSubBtn("tableAddColumn")),b.append(l.buildSubBtn("tableDeleteRow")),b.append(l.buildSubBtn("tableDeleteColumn")),b.append(l.buildSubBtn("tableDestroy"));else{var r=e("<table/>");e("<tbody/>").appendTo(r);for(var i=0;i<l.o.plugins.table.rows;i+=1)for(var s=e("<tr/>").appendTo(r),u=0;u<l.o.plugins.table.columns;u+=1)e("<td/>").appendTo(s);r.find("td").on("mouseover",a),r.find("td").on("mousedown",d),b.append(r),b.append(e('<div class="trumbowyg-table-size">1x1</div>'))}l.dropdown(t)}},a=function(t){var l=e(t.target),o=l.closest("table"),a=this.cellIndex,d=this.parentNode.rowIndex;o.find("td").removeClass("active");for(var n=0;n<=d;n+=1)for(var b=0;b<=a;b+=1)o.find("tr:nth-of-type("+(n+1)+")").find("td:nth-of-type("+(b+1)+")").addClass("active");o.next(".trumbowyg-table-size").html(a+1+"x"+(d+1))},d=function(){l.saveRange();var t=e("<table/>");e("<tbody/>").appendTo(t),l.o.plugins.table.styler&&t.attr("class",l.o.plugins.table.styler);for(var o=this.cellIndex,a=this.parentNode.rowIndex,d=0;d<=a;d+=1)for(var n=e("<tr></tr>").appendTo(t),b=0;b<=o;b+=1)e("<td/>").appendTo(n);l.range.deleteContents(),l.range.insertNode(t[0]),l.$c.trigger("tbwchange")},n={title:l.lang.tableAddRow,text:l.lang.tableAddRow,ico:"row-below",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("tr"),a=e(t).closest("table");if(a.length>0){for(var d=e("<tr/>"),n=0;n<a.find("tr")[0].childElementCount;n+=1)e("<td/>").appendTo(d);o.after(d)}l.syncCode()}},b={title:l.lang.tableAddRowAbove,text:l.lang.tableAddRowAbove,ico:"row-above",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("tr"),a=e(t).closest("table");if(a.length>0){for(var d=e("<tr/>"),n=0;n<a.find("tr")[0].childElementCount;n+=1)e("<td/>").appendTo(d);o.before(d)}l.syncCode()}},r={title:l.lang.tableAddColumn,text:l.lang.tableAddColumn,ico:"col-right",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("td"),a=e(t).closest("table"),d=o.index();a.length>0&&e(a).find("tr").each(function(){e(e(this).children()[d]).after("<td></td>")}),l.syncCode()}},i={title:l.lang.tableAddColumnLeft,text:l.lang.tableAddColumnLeft,ico:"col-left",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("td"),a=e(t).closest("table"),d=o.index();a.length>0&&e(a).find("tr").each(function(){e(e(this).children()[d]).before("<td></td>")}),l.syncCode()}},s={title:l.lang.tableDestroy,text:l.lang.tableDestroy,ico:"table-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("table");o.remove(),l.syncCode()}},u={title:l.lang.tableDeleteRow,text:l.lang.tableDeleteRow,ico:"row-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("tr");o.remove(),l.syncCode()}},c={title:l.lang.tableDeleteColumn,text:l.lang.tableDeleteColumn,ico:"col-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("table"),a=e(t).closest("td"),d=a.index();e(o).find("tr").each(function(){e(this).find("td:eq("+d+")").remove()}),l.syncCode()}};l.addBtnDef("table",o),l.addBtnDef("tableAddRowAbove",b),l.addBtnDef("tableAddRow",n),l.addBtnDef("tableAddColumnLeft",i),l.addBtnDef("tableAddColumn",r),l.addBtnDef("tableDeleteRow",u),l.addBtnDef("tableDeleteColumn",c),l.addBtnDef("tableDestroy",s)}}}})}(jQuery);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
|
3
|
+
* Default stylesheet for Trumbowyg editor plugin
|
4
|
+
* ------------------------
|
5
|
+
* @link http://alex-d.github.io/Trumbowyg
|
6
|
+
* @license MIT
|
7
|
+
* @author Alexandre Demode (Alex-D)
|
8
|
+
* Twitter : @AlexandreDemode
|
9
|
+
* Website : alex-d.fr
|
10
|
+
*/
|
11
|
+
|
12
|
+
.trumbowyg-editor table {
|
13
|
+
width: 100%;
|
14
|
+
|
15
|
+
td {
|
16
|
+
border: 1px dotted #e7eaec;
|
17
|
+
padding: 8px;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.trumbowyg-dropdown-table {
|
22
|
+
table {
|
23
|
+
margin: 10px;
|
24
|
+
display: inline-block;
|
25
|
+
}
|
26
|
+
|
27
|
+
table td {
|
28
|
+
display: inline-block;
|
29
|
+
height: 20px;
|
30
|
+
width: 20px;
|
31
|
+
margin: 1px;
|
32
|
+
padding: 0;
|
33
|
+
background-color: #fff;
|
34
|
+
box-shadow: 0 0 0 1px #cecece inset;
|
35
|
+
|
36
|
+
&.active {
|
37
|
+
background-color: #00b393;
|
38
|
+
box-shadow: none;
|
39
|
+
cursor: pointer;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
.trumbowyg-table-size {
|
44
|
+
text-align: center;
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/**
|
2
|
+
* Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
|
3
|
+
* Trumbowyg plugin stylesheet
|
4
|
+
* ------------------------
|
5
|
+
* @link http://alex-d.github.io/Trumbowyg
|
6
|
+
* @license MIT
|
7
|
+
* @author Alexandre Demode (Alex-D)
|
8
|
+
* Twitter : @AlexandreDemode
|
9
|
+
* Website : alex-d.fr
|
10
|
+
*/
|
11
|
+
|
12
|
+
.trumbowyg-editor table {
|
13
|
+
width: 100%; }
|
14
|
+
.trumbowyg-editor table td {
|
15
|
+
border: 1px dotted #e7eaec;
|
16
|
+
padding: 8px; }
|
17
|
+
|
18
|
+
.trumbowyg-dropdown-table table {
|
19
|
+
margin: 10px;
|
20
|
+
display: inline-block; }
|
21
|
+
|
22
|
+
.trumbowyg-dropdown-table table td {
|
23
|
+
display: inline-block;
|
24
|
+
height: 20px;
|
25
|
+
width: 20px;
|
26
|
+
margin: 1px;
|
27
|
+
padding: 0;
|
28
|
+
background-color: #fff;
|
29
|
+
box-shadow: 0 0 0 1px #cecece inset; }
|
30
|
+
.trumbowyg-dropdown-table table td.active {
|
31
|
+
background-color: #00b393;
|
32
|
+
box-shadow: none;
|
33
|
+
cursor: pointer; }
|
34
|
+
|
35
|
+
.trumbowyg-dropdown-table .trumbowyg-table-size {
|
36
|
+
text-align: center; }
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/** Trumbowyg v2.21.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
2
|
+
.trumbowyg-editor table{width:100%}.trumbowyg-editor table td{border:1px dotted #e7eaec;padding:8px}.trumbowyg-dropdown-table table{margin:10px;display:inline-block}.trumbowyg-dropdown-table table td{display:inline-block;height:20px;width:20px;margin:1px;padding:0;background-color:#fff;box-shadow:0 0 0 1px #cecece inset}.trumbowyg-dropdown-table table td.active{background-color:#00b393;box-shadow:none;cursor:pointer}.trumbowyg-dropdown-table .trumbowyg-table-size{text-align:center}
|
@@ -1,21 +1,44 @@
|
|
1
|
-
(function($) {
|
1
|
+
(function ($) {
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
// Adds the language variables
|
5
5
|
$.extend(true, $.trumbowyg, {
|
6
6
|
langs: {
|
7
|
+
// jshint camelcase:false
|
7
8
|
en: {
|
8
9
|
template: 'Template'
|
9
10
|
},
|
11
|
+
da: {
|
12
|
+
template: 'Skabelon'
|
13
|
+
},
|
14
|
+
de: {
|
15
|
+
template: 'Vorlage'
|
16
|
+
},
|
17
|
+
fr: {
|
18
|
+
template: 'Patron'
|
19
|
+
},
|
20
|
+
ja: {
|
21
|
+
template: 'テンプレート'
|
22
|
+
},
|
23
|
+
ko: {
|
24
|
+
template: '서식'
|
25
|
+
},
|
10
26
|
nl: {
|
11
27
|
template: 'Sjabloon'
|
12
28
|
},
|
29
|
+
pt_br: {
|
30
|
+
template: 'Modelo'
|
31
|
+
},
|
13
32
|
ru: {
|
14
33
|
template: 'Шаблон'
|
15
34
|
},
|
16
|
-
|
17
|
-
template: '
|
18
|
-
}
|
35
|
+
tr: {
|
36
|
+
template: 'Şablon'
|
37
|
+
},
|
38
|
+
zh_tw: {
|
39
|
+
template: '模板',
|
40
|
+
},
|
41
|
+
// jshint camelcase:true
|
19
42
|
}
|
20
43
|
});
|
21
44
|
|
@@ -23,10 +46,10 @@
|
|
23
46
|
$.extend(true, $.trumbowyg, {
|
24
47
|
plugins: {
|
25
48
|
template: {
|
26
|
-
shouldInit: function(trumbowyg) {
|
49
|
+
shouldInit: function (trumbowyg) {
|
27
50
|
return trumbowyg.o.plugins.hasOwnProperty('templates');
|
28
51
|
},
|
29
|
-
init: function(trumbowyg) {
|
52
|
+
init: function (trumbowyg) {
|
30
53
|
trumbowyg.addBtnDef('template', {
|
31
54
|
dropdown: templateSelector(trumbowyg),
|
32
55
|
hasIcon: false,
|
@@ -42,9 +65,9 @@
|
|
42
65
|
var available = trumbowyg.o.plugins.templates;
|
43
66
|
var templates = [];
|
44
67
|
|
45
|
-
$.each(available, function(index, template) {
|
68
|
+
$.each(available, function (index, template) {
|
46
69
|
trumbowyg.addBtnDef('template_' + index, {
|
47
|
-
fn: function(){
|
70
|
+
fn: function () {
|
48
71
|
trumbowyg.html(template.html);
|
49
72
|
},
|
50
73
|
hasIcon: false,
|
@@ -55,4 +78,4 @@
|
|
55
78
|
|
56
79
|
return templates;
|
57
80
|
}
|
58
|
-
})(jQuery);
|
81
|
+
})(jQuery);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(t){"use strict";function e(e){var n=e.o.plugins.templates,a=[];return t.each(n,function(t,n){e.addBtnDef("template_"+t,{fn:function(){e.html(n.html)},hasIcon:!1,title:n.name}),a.push("template_"+t)}),a}t.extend(!0,t.trumbowyg,{langs:{en:{template:"Template"},nl:{template:"Sjabloon"},ru:{template:"Шаблон"},
|
1
|
+
!function(t){"use strict";function e(e){var n=e.o.plugins.templates,a=[];return t.each(n,function(t,n){e.addBtnDef("template_"+t,{fn:function(){e.html(n.html)},hasIcon:!1,title:n.name}),a.push("template_"+t)}),a}t.extend(!0,t.trumbowyg,{langs:{en:{template:"Template"},da:{template:"Skabelon"},de:{template:"Vorlage"},fr:{template:"Patron"},ja:{template:"テンプレート"},ko:{template:"서식"},nl:{template:"Sjabloon"},pt_br:{template:"Modelo"},ru:{template:"Шаблон"},tr:{template:"Şablon"},zh_tw:{template:"模板"}}}),t.extend(!0,t.trumbowyg,{plugins:{template:{shouldInit:function(t){return t.o.plugins.hasOwnProperty("templates")},init:function(t){t.addBtnDef("template",{dropdown:e(t),hasIcon:!1,text:t.lang.template})}}}})}(jQuery);
|
@@ -23,7 +23,8 @@
|
|
23
23
|
urlPropertyName: 'file', // How to get url from the json response (for instance 'url' for {url: ....})
|
24
24
|
statusPropertyName: 'success', // How to get status from the json response
|
25
25
|
success: undefined, // Success callback: function (data, trumbowyg, $modal, values) {}
|
26
|
-
error: undefined
|
26
|
+
error: undefined, // Error callback: function () {}
|
27
|
+
imageWidthModalEdit: false // Add ability to edit image width
|
27
28
|
};
|
28
29
|
|
29
30
|
function getDeep(object, propertyParts) {
|
@@ -52,6 +53,16 @@
|
|
52
53
|
file: 'File',
|
53
54
|
uploadError: 'Error'
|
54
55
|
},
|
56
|
+
da: {
|
57
|
+
upload: 'Upload',
|
58
|
+
file: 'Fil',
|
59
|
+
uploadError: 'Fejl'
|
60
|
+
},
|
61
|
+
de: {
|
62
|
+
upload: 'Hochladen',
|
63
|
+
file: 'Datei',
|
64
|
+
uploadError: 'Fehler'
|
65
|
+
},
|
55
66
|
sk: {
|
56
67
|
upload: 'Nahrať',
|
57
68
|
file: 'Súbor',
|
@@ -76,7 +87,7 @@
|
|
76
87
|
upload: '上傳',
|
77
88
|
file: '文件',
|
78
89
|
uploadError: '錯誤'
|
79
|
-
},
|
90
|
+
},
|
80
91
|
ru: {
|
81
92
|
upload: 'Загрузка',
|
82
93
|
file: 'Файл',
|
@@ -92,6 +103,16 @@
|
|
92
103
|
file: 'Arquivo',
|
93
104
|
uploadError: 'Erro'
|
94
105
|
},
|
106
|
+
tr: {
|
107
|
+
upload: 'Yükle',
|
108
|
+
file: 'Dosya',
|
109
|
+
uploadError: 'Hata'
|
110
|
+
},
|
111
|
+
ko: {
|
112
|
+
upload: '그림 올리기',
|
113
|
+
file: '파일',
|
114
|
+
uploadError: '에러'
|
115
|
+
},
|
95
116
|
},
|
96
117
|
// jshint camelcase:true
|
97
118
|
|
@@ -106,24 +127,32 @@
|
|
106
127
|
var file,
|
107
128
|
prefix = trumbowyg.o.prefix;
|
108
129
|
|
130
|
+
var fields = {
|
131
|
+
file: {
|
132
|
+
type: 'file',
|
133
|
+
required: true,
|
134
|
+
attributes: {
|
135
|
+
accept: 'image/*'
|
136
|
+
}
|
137
|
+
},
|
138
|
+
alt: {
|
139
|
+
label: 'description',
|
140
|
+
value: trumbowyg.getRangeText()
|
141
|
+
}
|
142
|
+
};
|
143
|
+
|
144
|
+
if (trumbowyg.o.plugins.upload.imageWidthModalEdit) {
|
145
|
+
fields.width = {
|
146
|
+
value: ''
|
147
|
+
};
|
148
|
+
}
|
149
|
+
|
109
150
|
var $modal = trumbowyg.openModalInsert(
|
110
151
|
// Title
|
111
152
|
trumbowyg.lang.upload,
|
112
153
|
|
113
154
|
// Fields
|
114
|
-
|
115
|
-
file: {
|
116
|
-
type: 'file',
|
117
|
-
required: true,
|
118
|
-
attributes: {
|
119
|
-
accept: 'image/*'
|
120
|
-
}
|
121
|
-
},
|
122
|
-
alt: {
|
123
|
-
label: 'description',
|
124
|
-
value: trumbowyg.getRangeText()
|
125
|
-
}
|
126
|
-
},
|
155
|
+
fields,
|
127
156
|
|
128
157
|
// Callback
|
129
158
|
function (values) {
|
@@ -133,9 +162,9 @@
|
|
133
162
|
trumbowyg.o.plugins.upload.data.map(function (cur) {
|
134
163
|
data.append(cur.name, cur.value);
|
135
164
|
});
|
136
|
-
|
137
|
-
$.map(values, function(curr, key){
|
138
|
-
if(key !== 'file') {
|
165
|
+
|
166
|
+
$.map(values, function (curr, key) {
|
167
|
+
if (key !== 'file') {
|
139
168
|
data.append(key, curr);
|
140
169
|
}
|
141
170
|
});
|
@@ -174,8 +203,14 @@
|
|
174
203
|
} else {
|
175
204
|
if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
|
176
205
|
var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
|
177
|
-
trumbowyg.execCmd('insertImage', url);
|
178
|
-
$('img[src="' + url + '"]:not([alt])', trumbowyg.$box)
|
206
|
+
trumbowyg.execCmd('insertImage', url, false, true);
|
207
|
+
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
|
208
|
+
$img.attr('alt', values.alt);
|
209
|
+
if (trumbowyg.o.imageWidthModalEdit && parseInt(values.width) > 0) {
|
210
|
+
$img.attr({
|
211
|
+
width: values.width
|
212
|
+
});
|
213
|
+
}
|
179
214
|
setTimeout(function () {
|
180
215
|
trumbowyg.closeModal();
|
181
216
|
}, 250);
|
@@ -219,14 +254,14 @@
|
|
219
254
|
}
|
220
255
|
});
|
221
256
|
|
222
|
-
|
223
257
|
function addXhrProgressEvent() {
|
224
258
|
if (!$.trumbowyg.addedXhrProgressEvent) { // Avoid adding progress event multiple times
|
225
259
|
var originalXhr = $.ajaxSettings.xhr;
|
226
260
|
$.ajaxSetup({
|
227
261
|
xhr: function () {
|
228
|
-
var
|
229
|
-
|
262
|
+
var that = this,
|
263
|
+
req = originalXhr();
|
264
|
+
|
230
265
|
if (req && typeof req.upload === 'object' && that.progressUpload !== undefined) {
|
231
266
|
req.upload.addEventListener('progress', function (e) {
|
232
267
|
that.progressUpload(e);
|
@@ -1 +1 @@
|
|
1
|
-
!function(r){"use strict";function e(r,a){var o=a.shift(),l=a;if(null!==r){if(0===l.length)return r[o];if("object"==typeof r)return e(r[o],l)}return r}function a(){if(!r.trumbowyg.addedXhrProgressEvent){var e=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=e()
|
1
|
+
!function(r){"use strict";function e(r,a){var o=a.shift(),l=a;if(null!==r){if(0===l.length)return r[o];if("object"==typeof r)return e(r[o],l)}return r}function a(){if(!r.trumbowyg.addedXhrProgressEvent){var e=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=this,a=e();return a&&"object"==typeof a.upload&&void 0!==r.progressUpload&&a.upload.addEventListener("progress",function(e){r.progressUpload(e)},!1),a}}),r.trumbowyg.addedXhrProgressEvent=!0}}var o={serverPath:"",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0,imageWidthModalEdit:!1};a(),r.extend(!0,r.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},da:{upload:"Upload",file:"Fil",uploadError:"Fejl"},de:{upload:"Hochladen",file:"Datei",uploadError:"Fehler"},sk:{upload:"Nahrať",file:"Súbor",uploadError:"Chyba"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"},cs:{upload:"Nahrát obrázek",file:"Soubor",uploadError:"Chyba"},zh_cn:{upload:"上传",file:"文件",uploadError:"错误"},zh_tw:{upload:"上傳",file:"文件",uploadError:"錯誤"},ru:{upload:"Загрузка",file:"Файл",uploadError:"Ошибка"},ja:{upload:"アップロード",file:"ファイル",uploadError:"エラー"},pt_br:{upload:"Enviar do local",file:"Arquivo",uploadError:"Erro"},tr:{upload:"Yükle",file:"Dosya",uploadError:"Hata"},ko:{upload:"그림 올리기",file:"파일",uploadError:"에러"}},plugins:{upload:{init:function(a){a.o.plugins.upload=r.extend(!0,{},o,a.o.plugins.upload||{});var l={fn:function(){a.saveRange();var o,l=a.o.prefix,t={file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:a.getRangeText()}};a.o.plugins.upload.imageWidthModalEdit&&(t.width={value:""});var d=a.openModalInsert(a.lang.upload,t,function(t){var i=new FormData;i.append(a.o.plugins.upload.fileFieldName,o),a.o.plugins.upload.data.map(function(r){i.append(r.name,r.value)}),r.map(t,function(r,e){"file"!==e&&i.append(e,r)}),0===r("."+l+"progress",d).length&&r("."+l+"modal-title",d).after(r("<div/>",{"class":l+"progress"}).append(r("<div/>",{"class":l+"progress-bar"}))),r.ajax({url:a.o.plugins.upload.serverPath,headers:a.o.plugins.upload.headers,xhrFields:a.o.plugins.upload.xhrFields,type:"POST",data:i,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(e){r("."+l+"progress-bar").css("width",Math.round(100*e.loaded/e.total)+"%")},success:function(o){if(a.o.plugins.upload.success)a.o.plugins.upload.success(o,a,d,t);else if(e(o,a.o.plugins.upload.statusPropertyName.split("."))){var l=e(o,a.o.plugins.upload.urlPropertyName.split("."));a.execCmd("insertImage",l,!1,!0);var i=r('img[src="'+l+'"]:not([alt])',a.$box);i.attr("alt",t.alt),a.o.imageWidthModalEdit&&parseInt(t.width)>0&&i.attr({width:t.width}),setTimeout(function(){a.closeModal()},250),a.$c.trigger("tbwuploadsuccess",[a,o,l])}else a.addErrorOnModalField(r("input[type=file]",d),a.lang[o.message]),a.$c.trigger("tbwuploaderror",[a,o])},error:a.o.plugins.upload.error||function(){a.addErrorOnModalField(r("input[type=file]",d),a.lang.uploadError),a.$c.trigger("tbwuploaderror",[a])}})});r("input[type=file]").on("change",function(r){try{o=r.target.files[0]}catch(e){o=r.target.value}})}};a.addBtnDef("upload",l)}}}})}(jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Trumbowyg v2.
|
2
|
+
* Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
|
3
3
|
* Trumbowyg core file
|
4
4
|
* ------------------------
|
5
5
|
* @link http://alex-d.github.io/Trumbowyg
|
@@ -25,7 +25,7 @@ jQuery.trumbowyg = {
|
|
25
25
|
|
26
26
|
bold: 'Bold',
|
27
27
|
italic: 'Italic',
|
28
|
-
strikethrough: '
|
28
|
+
strikethrough: 'Strikethrough',
|
29
29
|
underline: 'Underline',
|
30
30
|
|
31
31
|
strong: 'Strong',
|
@@ -62,7 +62,8 @@ jQuery.trumbowyg = {
|
|
62
62
|
description: 'Description',
|
63
63
|
title: 'Title',
|
64
64
|
text: 'Text',
|
65
|
-
target: 'Target'
|
65
|
+
target: 'Target',
|
66
|
+
width: 'Width'
|
66
67
|
}
|
67
68
|
},
|
68
69
|
|
@@ -84,13 +85,17 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
84
85
|
fixedFullWidth: false,
|
85
86
|
autogrow: false,
|
86
87
|
autogrowOnEnter: false,
|
88
|
+
imageWidthModalEdit: false,
|
87
89
|
|
88
90
|
prefix: 'trumbowyg-',
|
89
91
|
|
90
92
|
semantic: true,
|
93
|
+
semanticKeepAttributes: false,
|
91
94
|
resetCss: false,
|
92
95
|
removeformatPasted: false,
|
96
|
+
tabToIndent: false,
|
93
97
|
tagsToRemove: [],
|
98
|
+
tagsToKeep: ['hr', 'img', 'embed', 'iframe', 'input'],
|
94
99
|
btns: [
|
95
100
|
['viewHTML'],
|
96
101
|
['undo', 'redo'], // Only supported in Blink browsers
|
@@ -107,6 +112,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
107
112
|
],
|
108
113
|
// For custom button definitions
|
109
114
|
btnsDef: {},
|
115
|
+
changeActiveDropdownIcon: false,
|
110
116
|
|
111
117
|
inlineElementsSelector: 'a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u',
|
112
118
|
|
@@ -114,14 +120,16 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
114
120
|
|
115
121
|
// imgDblClickHandler: default is defined in constructor
|
116
122
|
|
117
|
-
plugins: {}
|
123
|
+
plugins: {},
|
124
|
+
urlProtocol: false,
|
125
|
+
minimalLinks: false,
|
126
|
+
defaultLinkTarget: undefined
|
118
127
|
},
|
119
128
|
writable: false,
|
120
129
|
enumerable: true,
|
121
130
|
configurable: false
|
122
131
|
});
|
123
132
|
|
124
|
-
|
125
133
|
(function (navigator, window, document, $) {
|
126
134
|
'use strict';
|
127
135
|
|
@@ -143,7 +151,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
143
151
|
switch (options) {
|
144
152
|
// Exec command
|
145
153
|
case 'execCmd':
|
146
|
-
return t.execCmd(params.cmd, params.param, params.forceCss);
|
154
|
+
return t.execCmd(params.cmd, params.param, params.forceCss, params.skipTrumbowyg);
|
147
155
|
|
148
156
|
// Modal box
|
149
157
|
case 'openModal':
|
@@ -169,6 +177,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
169
177
|
case 'disable':
|
170
178
|
return t.setDisabled(true);
|
171
179
|
|
180
|
+
// Toggle
|
181
|
+
case 'toggle':
|
182
|
+
return t.toggle();
|
183
|
+
|
172
184
|
// Destroy
|
173
185
|
case 'destroy':
|
174
186
|
return t.destroy();
|
@@ -220,25 +232,17 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
220
232
|
if ($('#' + trumbowygIconsId, t.doc).length === 0 && svgPathOption !== false) {
|
221
233
|
if (svgPathOption == null) {
|
222
234
|
// Hack to get svgPathOption based on trumbowyg.js path
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
var stackLines = e.stack.split('\n');
|
230
|
-
|
231
|
-
for (var i in stackLines) {
|
232
|
-
if (!stackLines[i].match(/https?:\/\//)) {
|
233
|
-
continue;
|
234
|
-
}
|
235
|
-
svgPathOption = stackLines[Number(i)].match(/((https?:\/\/.+\/)([^\/]+\.js))(\?.*)?:/)[1].split('/');
|
236
|
-
svgPathOption.pop();
|
237
|
-
svgPathOption = svgPathOption.join('/') + '/ui/icons.svg';
|
238
|
-
break;
|
239
|
-
}
|
235
|
+
var scriptElements = document.getElementsByTagName('script');
|
236
|
+
for (var i = 0; i < scriptElements.length; i += 1) {
|
237
|
+
var source = scriptElements[i].src;
|
238
|
+
var matches = source.match('trumbowyg(\.min)?\.js');
|
239
|
+
if (matches != null) {
|
240
|
+
svgPathOption = source.substring(0, source.indexOf(matches[0])) + 'ui/icons.svg';
|
240
241
|
}
|
241
242
|
}
|
243
|
+
if (svgPathOption == null) {
|
244
|
+
console.warn('You must define svgPath: https://goo.gl/CfTY9U'); // jshint ignore:line
|
245
|
+
}
|
242
246
|
}
|
243
247
|
|
244
248
|
var div = t.doc.createElement('div');
|
@@ -263,7 +267,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
263
267
|
|
264
268
|
/**
|
265
269
|
* When the button is associated to a empty object
|
266
|
-
* fn and title
|
270
|
+
* fn and title attributes are defined from the button key value
|
267
271
|
*
|
268
272
|
* For example
|
269
273
|
* foo: {}
|
@@ -279,7 +283,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
279
283
|
};
|
280
284
|
t.btnsDef = {
|
281
285
|
viewHTML: {
|
282
|
-
fn: 'toggle'
|
286
|
+
fn: 'toggle',
|
287
|
+
class: 'trumbowyg-not-disable',
|
283
288
|
},
|
284
289
|
|
285
290
|
undo: {
|
@@ -313,6 +318,14 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
313
318
|
fn: 'formatBlock',
|
314
319
|
title: h + ' 4'
|
315
320
|
},
|
321
|
+
h5: {
|
322
|
+
fn: 'formatBlock',
|
323
|
+
title: h + ' 5'
|
324
|
+
},
|
325
|
+
h6: {
|
326
|
+
fn: 'formatBlock',
|
327
|
+
title: h + ' 6'
|
328
|
+
},
|
316
329
|
subscript: {
|
317
330
|
tag: 'sub'
|
318
331
|
},
|
@@ -411,6 +424,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
411
424
|
t.o.imgDblClickHandler = t.getDefaultImgDblClickHandler();
|
412
425
|
}
|
413
426
|
|
427
|
+
t.urlPrefix = t.setupUrlPrefix();
|
428
|
+
|
414
429
|
t.disabled = t.o.disabled || (editorElem.nodeName === 'TEXTAREA' && editorElem.disabled);
|
415
430
|
|
416
431
|
if (options.btns) {
|
@@ -437,12 +452,23 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
437
452
|
t.pasteHandlers = [].concat(t.o.pasteHandlers);
|
438
453
|
|
439
454
|
// Check if browser is IE
|
440
|
-
t.isIE =
|
455
|
+
t.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') !== -1;
|
456
|
+
|
457
|
+
// Check if we are on macOs
|
458
|
+
t.isMac = navigator.platform.toUpperCase().indexOf('MAC') !== -1;
|
441
459
|
|
442
460
|
t.init();
|
443
461
|
};
|
444
462
|
|
445
463
|
Trumbowyg.prototype = {
|
464
|
+
DEFAULT_SEMANTIC_MAP: {
|
465
|
+
'b': 'strong',
|
466
|
+
'i': 'em',
|
467
|
+
's': 'del',
|
468
|
+
'strike': 'del',
|
469
|
+
'div': 'p'
|
470
|
+
},
|
471
|
+
|
446
472
|
init: function () {
|
447
473
|
var t = this;
|
448
474
|
t.height = t.$ta.height();
|
@@ -472,7 +498,19 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
472
498
|
},
|
473
499
|
|
474
500
|
addBtnDef: function (btnName, btnDef) {
|
475
|
-
this.btnsDef[btnName] = btnDef;
|
501
|
+
this.btnsDef[btnName] = $.extend(btnDef, this.btnsDef[btnName] || {});
|
502
|
+
},
|
503
|
+
|
504
|
+
setupUrlPrefix: function () {
|
505
|
+
var protocol = this.o.urlProtocol;
|
506
|
+
if (!protocol) {
|
507
|
+
return;
|
508
|
+
}
|
509
|
+
|
510
|
+
if (typeof(protocol) !== 'string') {
|
511
|
+
return 'https://';
|
512
|
+
}
|
513
|
+
return protocol.replace('://', '') + '://';
|
476
514
|
},
|
477
515
|
|
478
516
|
buildEditor: function () {
|
@@ -552,8 +590,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
552
590
|
|
553
591
|
var ctrl = false,
|
554
592
|
composition = false,
|
555
|
-
debounceButtonPaneStatus
|
556
|
-
updateEventName = t.isIE ? 'keyup' : 'input';
|
593
|
+
debounceButtonPaneStatus;
|
557
594
|
|
558
595
|
t.$ed
|
559
596
|
.on('dblclick', 'img', t.o.imgDblClickHandler)
|
@@ -565,14 +602,24 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
565
602
|
try {
|
566
603
|
t.execCmd(key.fn, key.param);
|
567
604
|
return false;
|
568
|
-
} catch (c) {
|
605
|
+
} catch (c) {}
|
606
|
+
} else {
|
607
|
+
if (t.o.tabToIndent && e.key === 'Tab') {
|
608
|
+
try {
|
609
|
+
if (e.shiftKey) {
|
610
|
+
t.execCmd('outdent', true, null);
|
611
|
+
} else {
|
612
|
+
t.execCmd('indent', true, null);
|
613
|
+
}
|
614
|
+
return false;
|
615
|
+
} catch (c) {}
|
569
616
|
}
|
570
617
|
}
|
571
618
|
})
|
572
619
|
.on('compositionstart compositionupdate', function () {
|
573
620
|
composition = true;
|
574
621
|
})
|
575
|
-
.on(
|
622
|
+
.on('keyup compositionend', function (e) {
|
576
623
|
if (e.type === 'compositionend') {
|
577
624
|
composition = false;
|
578
625
|
} else if (composition) {
|
@@ -586,9 +633,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
586
633
|
}
|
587
634
|
|
588
635
|
if ((e.ctrlKey || e.metaKey) && (keyCode === 89 || keyCode === 90)) {
|
636
|
+
t.semanticCode(false, true);
|
589
637
|
t.$c.trigger('tbwchange');
|
590
638
|
} else if (!ctrl && keyCode !== 17) {
|
591
|
-
t.
|
639
|
+
var compositionEndIE = t.isIE ? e.type === 'compositionend' : true;
|
640
|
+
t.semanticCode(false, compositionEndIE && keyCode === 13);
|
592
641
|
t.$c.trigger('tbwchange');
|
593
642
|
} else if (typeof e.which === 'undefined') {
|
594
643
|
t.semanticCode(false, false, true);
|
@@ -596,19 +645,24 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
596
645
|
|
597
646
|
setTimeout(function () {
|
598
647
|
ctrl = false;
|
599
|
-
},
|
648
|
+
}, 50);
|
600
649
|
})
|
601
|
-
.on('mouseup keydown keyup', function () {
|
650
|
+
.on('mouseup keydown keyup', function (e) {
|
651
|
+
if ((!e.ctrlKey && !e.metaKey) || e.altKey) {
|
652
|
+
setTimeout(function () { // "hold on" to the ctrl key for 50ms
|
653
|
+
ctrl = false;
|
654
|
+
}, 50);
|
655
|
+
}
|
602
656
|
clearTimeout(debounceButtonPaneStatus);
|
603
657
|
debounceButtonPaneStatus = setTimeout(function () {
|
604
658
|
t.updateButtonPaneStatus();
|
605
659
|
}, 50);
|
606
660
|
})
|
607
661
|
.on('focus blur', function (e) {
|
608
|
-
t.$c.trigger('tbw' + e.type);
|
609
662
|
if (e.type === 'blur') {
|
610
|
-
|
663
|
+
t.clearButtonPaneStatus();
|
611
664
|
}
|
665
|
+
t.$c.trigger('tbw' + e.type);
|
612
666
|
if (t.o.autogrowOnEnter) {
|
613
667
|
if (t.autogrowOnEnterDontClose) {
|
614
668
|
return;
|
@@ -623,7 +677,16 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
623
677
|
}
|
624
678
|
}
|
625
679
|
})
|
626
|
-
.on('
|
680
|
+
.on('keyup focus', function () {
|
681
|
+
if (!t.$ta.val().match(/<.*>/)) {
|
682
|
+
setTimeout(function () {
|
683
|
+
var block = t.isIE ? '<p>' : 'p';
|
684
|
+
t.doc.execCommand('formatBlock', false, block);
|
685
|
+
t.syncCode();
|
686
|
+
}, 0);
|
687
|
+
}
|
688
|
+
})
|
689
|
+
.on('cut drop', function () {
|
627
690
|
setTimeout(function () {
|
628
691
|
t.semanticCode(false, true);
|
629
692
|
t.$c.trigger('tbwchange');
|
@@ -663,6 +726,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
663
726
|
setTimeout(function () {
|
664
727
|
t.semanticCode(false, true);
|
665
728
|
t.$c.trigger('tbwpaste', e);
|
729
|
+
t.$c.trigger('tbwchange');
|
666
730
|
}, 0);
|
667
731
|
});
|
668
732
|
|
@@ -676,8 +740,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
676
740
|
}, 0);
|
677
741
|
});
|
678
742
|
|
679
|
-
t
|
680
|
-
if (e.which === 27 && $('.' + prefix + 'modal-box'
|
743
|
+
$(t.doc.body).on('keydown.' + t.eventNamespace, function (e) {
|
744
|
+
if (e.which === 27 && $('.' + prefix + 'modal-box').length >= 1) {
|
681
745
|
t.closeModal();
|
682
746
|
return false;
|
683
747
|
}
|
@@ -727,7 +791,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
727
791
|
} catch (c) {
|
728
792
|
}
|
729
793
|
});
|
730
|
-
|
794
|
+
|
795
|
+
if ($btnGroup.html().trim().length > 0) {
|
796
|
+
$btnPane.append($btnGroup);
|
797
|
+
}
|
731
798
|
});
|
732
799
|
|
733
800
|
t.$box.prepend($btnPane);
|
@@ -749,14 +816,16 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
749
816
|
html: t.hasSvg && hasIcon ?
|
750
817
|
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' :
|
751
818
|
t.hideButtonTexts ? '' : (btn.text || btn.title || t.lang[btnName] || btnName),
|
752
|
-
title: (btn.title || btn.text || textDef) + (
|
819
|
+
title: (btn.title || btn.text || textDef) + (btn.key ? ' (' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : ''),
|
753
820
|
tabindex: -1,
|
754
821
|
mousedown: function () {
|
755
822
|
if (!isDropdown || $('.' + btnName + '-' + prefix + 'dropdown', t.$box).is(':hidden')) {
|
756
823
|
$('body', t.doc).trigger('mousedown');
|
757
824
|
}
|
758
825
|
|
759
|
-
if (t.$btnPane.hasClass(prefix + 'disable')
|
826
|
+
if ((t.$btnPane.hasClass(prefix + 'disable') || t.$box.hasClass(prefix + 'disabled')) &&
|
827
|
+
!$(this).hasClass(prefix + 'active') &&
|
828
|
+
!$(this).hasClass(prefix + 'not-disable')) {
|
760
829
|
return false;
|
761
830
|
}
|
762
831
|
|
@@ -769,10 +838,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
769
838
|
if (isDropdown) {
|
770
839
|
$btn.addClass(prefix + 'open-dropdown');
|
771
840
|
var dropdownPrefix = prefix + 'dropdown',
|
772
|
-
|
773
|
-
class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + prefix + 'fixed-top'
|
774
|
-
|
775
|
-
|
841
|
+
dropdownOptions = { // the dropdown
|
842
|
+
class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + prefix + 'fixed-top ' + (btn.dropdownClass || '')
|
843
|
+
};
|
844
|
+
dropdownOptions['data-' + dropdownPrefix] = btnName;
|
845
|
+
var $dropdown = $('<div/>', dropdownOptions);
|
776
846
|
$.each(isDropdown, function (i, def) {
|
777
847
|
if (t.btnsDef[def] && t.isSupportedBtn(def)) {
|
778
848
|
$dropdown.append(t.buildSubBtn(def));
|
@@ -811,9 +881,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
811
881
|
|
812
882
|
return $('<button/>', {
|
813
883
|
type: 'button',
|
814
|
-
class: prefix + btnName + '-dropdown-button' + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
|
815
|
-
html: t.hasSvg && hasIcon ?
|
816
|
-
|
884
|
+
class: prefix + btnName + '-dropdown-button ' + (btn.class || '') + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
|
885
|
+
html: t.hasSvg && hasIcon ?
|
886
|
+
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' + (btn.text || btn.title || t.lang[btnName] || btnName) :
|
887
|
+
(btn.text || btn.title || t.lang[btnName] || btnName),
|
888
|
+
title: (btn.key ? '(' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : null),
|
817
889
|
style: btn.style || null,
|
818
890
|
mousedown: function () {
|
819
891
|
$('body', t.doc).trigger('mousedown');
|
@@ -825,10 +897,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
825
897
|
});
|
826
898
|
},
|
827
899
|
// Check if button is supported
|
828
|
-
isSupportedBtn: function (
|
900
|
+
isSupportedBtn: function (btnName) {
|
829
901
|
try {
|
830
|
-
return this.btnsDef[
|
831
|
-
} catch (
|
902
|
+
return this.btnsDef[btnName].isSupported();
|
903
|
+
} catch (e) {
|
832
904
|
}
|
833
905
|
return true;
|
834
906
|
},
|
@@ -875,36 +947,36 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
875
947
|
|
876
948
|
var scrollTop = $(window).scrollTop(),
|
877
949
|
offset = $box.offset().top + 1,
|
878
|
-
|
879
|
-
|
950
|
+
$buttonPane = t.$btnPane,
|
951
|
+
buttonPaneOuterHeight = $buttonPane.outerHeight() - 2;
|
880
952
|
|
881
953
|
if ((scrollTop - offset > 0) && ((scrollTop - offset - t.height) < 0)) {
|
882
954
|
if (!t.isFixed) {
|
883
955
|
t.isFixed = true;
|
884
|
-
|
956
|
+
$buttonPane.css({
|
885
957
|
position: 'fixed',
|
886
958
|
top: 0,
|
887
|
-
left: fixedFullWidth ?
|
959
|
+
left: fixedFullWidth ? 0 : 'auto',
|
888
960
|
zIndex: 7
|
889
961
|
});
|
890
|
-
|
962
|
+
t.$box.css({paddingTop: $buttonPane.height()});
|
891
963
|
}
|
892
|
-
|
893
|
-
width: fixedFullWidth ? '100%' : (($box.width() - 1)
|
964
|
+
$buttonPane.css({
|
965
|
+
width: fixedFullWidth ? '100%' : (($box.width() - 1))
|
894
966
|
});
|
895
967
|
|
896
968
|
$('.' + t.o.prefix + 'fixed-top', $box).css({
|
897
969
|
position: fixedFullWidth ? 'fixed' : 'absolute',
|
898
|
-
top: fixedFullWidth ?
|
970
|
+
top: fixedFullWidth ? buttonPaneOuterHeight : buttonPaneOuterHeight + (scrollTop - offset),
|
899
971
|
zIndex: 15
|
900
972
|
});
|
901
973
|
} else if (t.isFixed) {
|
902
974
|
t.isFixed = false;
|
903
|
-
|
904
|
-
|
975
|
+
$buttonPane.removeAttr('style');
|
976
|
+
t.$box.css({paddingTop: 0});
|
905
977
|
$('.' + t.o.prefix + 'fixed-top', $box).css({
|
906
978
|
position: 'absolute',
|
907
|
-
top:
|
979
|
+
top: buttonPaneOuterHeight
|
908
980
|
});
|
909
981
|
}
|
910
982
|
});
|
@@ -960,6 +1032,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
960
1032
|
$('body').removeClass(prefix + 'body-fullscreen');
|
961
1033
|
t.$c.trigger('tbwclose');
|
962
1034
|
$(window).off('scroll.' + t.eventNamespace + ' resize.' + t.eventNamespace);
|
1035
|
+
$(t.doc.body).off('keydown.' + t.eventNamespace);
|
963
1036
|
},
|
964
1037
|
|
965
1038
|
|
@@ -980,6 +1053,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
980
1053
|
}
|
981
1054
|
|
982
1055
|
t.semanticCode(false, true);
|
1056
|
+
t.$c.trigger('tbwchange');
|
983
1057
|
|
984
1058
|
setTimeout(function () {
|
985
1059
|
t.doc.activeElement.blur();
|
@@ -1001,31 +1075,31 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1001
1075
|
// Open dropdown when click on a button which open that
|
1002
1076
|
dropdown: function (name) {
|
1003
1077
|
var t = this,
|
1004
|
-
|
1078
|
+
$body = $('body', t.doc),
|
1005
1079
|
prefix = t.o.prefix,
|
1006
|
-
$dropdown = $('[data-dropdown=' + name + ']', t.$box),
|
1080
|
+
$dropdown = $('[data-' + prefix + 'dropdown=' + name + ']', t.$box),
|
1007
1081
|
$btn = $('.' + prefix + name + '-button', t.$btnPane),
|
1008
1082
|
show = $dropdown.is(':hidden');
|
1009
1083
|
|
1010
|
-
$
|
1084
|
+
$body.trigger('mousedown');
|
1011
1085
|
|
1012
1086
|
if (show) {
|
1013
|
-
var
|
1087
|
+
var btnOffsetLeft = $btn.offset().left;
|
1014
1088
|
$btn.addClass(prefix + 'active');
|
1015
1089
|
|
1016
1090
|
$dropdown.css({
|
1017
1091
|
position: 'absolute',
|
1018
1092
|
top: $btn.offset().top - t.$btnPane.offset().top + $btn.outerHeight(),
|
1019
|
-
left: (t.o.fixedFullWidth && t.isFixed) ?
|
1093
|
+
left: (t.o.fixedFullWidth && t.isFixed) ? btnOffsetLeft : (btnOffsetLeft - t.$btnPane.offset().left)
|
1020
1094
|
}).show();
|
1021
1095
|
|
1022
1096
|
$(window).trigger('scroll');
|
1023
1097
|
|
1024
|
-
$
|
1098
|
+
$body.on('mousedown.' + t.eventNamespace, function (e) {
|
1025
1099
|
if (!$dropdown.is(e.target)) {
|
1026
|
-
$('.' + prefix + 'dropdown',
|
1027
|
-
$('.' + prefix + 'active',
|
1028
|
-
$
|
1100
|
+
$('.' + prefix + 'dropdown', t.$box).hide();
|
1101
|
+
$('.' + prefix + 'active', t.$btnPane).removeClass(prefix + 'active');
|
1102
|
+
$body.off('mousedown.' + t.eventNamespace);
|
1029
1103
|
}
|
1030
1104
|
});
|
1031
1105
|
}
|
@@ -1035,25 +1109,28 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1035
1109
|
// HTML Code management
|
1036
1110
|
html: function (html) {
|
1037
1111
|
var t = this;
|
1112
|
+
|
1038
1113
|
if (html != null) {
|
1039
1114
|
t.$ta.val(html);
|
1040
1115
|
t.syncCode(true);
|
1116
|
+
t.$c.trigger('tbwchange');
|
1041
1117
|
return t;
|
1042
1118
|
}
|
1119
|
+
|
1043
1120
|
return t.$ta.val();
|
1044
1121
|
},
|
1045
1122
|
syncTextarea: function () {
|
1046
1123
|
var t = this;
|
1047
|
-
t.$ta.val(t.$ed.text().trim().length > 0 || t.$ed.find('
|
1124
|
+
t.$ta.val(t.$ed.text().trim().length > 0 || t.$ed.find(t.o.tagsToKeep.join(',')).length > 0 ? t.$ed.html() : '');
|
1048
1125
|
},
|
1049
1126
|
syncCode: function (force) {
|
1050
1127
|
var t = this;
|
1051
1128
|
if (!force && t.$ed.is(':visible')) {
|
1052
1129
|
t.syncTextarea();
|
1053
1130
|
} else {
|
1054
|
-
// wrap the content in a div it's easier to get the
|
1131
|
+
// wrap the content in a div it's easier to get the inner html
|
1055
1132
|
var html = $('<div>').html(t.$ta.val());
|
1056
|
-
//scrub the html before loading into the doc
|
1133
|
+
// scrub the html before loading into the doc
|
1057
1134
|
var safe = $('<div>').append(html);
|
1058
1135
|
$(t.o.tagsToRemove.join(','), safe).remove();
|
1059
1136
|
t.$ed.html(safe.contents().html());
|
@@ -1067,11 +1144,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1067
1144
|
}
|
1068
1145
|
}
|
1069
1146
|
if (t.o.autogrowOnEnter) {
|
1070
|
-
// t.autogrowEditorOnEnter();
|
1071
1147
|
t.$ed.height('auto');
|
1072
|
-
var
|
1073
|
-
if (
|
1074
|
-
t.$ed.css({height:
|
1148
|
+
var totalHeight = t.autogrowOnEnterWasFocused ? t.$ed[0].scrollHeight : t.$ed.css('min-height');
|
1149
|
+
if (totalHeight !== t.$ta.css('height')) {
|
1150
|
+
t.$ed.css({height: totalHeight});
|
1075
1151
|
t.$c.trigger('tbwresize');
|
1076
1152
|
}
|
1077
1153
|
}
|
@@ -1087,9 +1163,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1087
1163
|
t.syncCode(force);
|
1088
1164
|
|
1089
1165
|
if (t.o.semantic) {
|
1090
|
-
t.semanticTag('b',
|
1091
|
-
t.semanticTag('i',
|
1092
|
-
t.semanticTag('
|
1166
|
+
t.semanticTag('b', t.o.semanticKeepAttributes);
|
1167
|
+
t.semanticTag('i', t.o.semanticKeepAttributes);
|
1168
|
+
t.semanticTag('s', t.o.semanticKeepAttributes);
|
1169
|
+
t.semanticTag('strike', t.o.semanticKeepAttributes);
|
1093
1170
|
|
1094
1171
|
if (full) {
|
1095
1172
|
var inlineElementsSelector = t.o.inlineElementsSelector,
|
@@ -1111,18 +1188,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1111
1188
|
};
|
1112
1189
|
wrapInlinesInParagraphsFrom(t.$ed.children(inlineElementsSelector).first());
|
1113
1190
|
|
1114
|
-
t.semanticTag('div',
|
1115
|
-
|
1116
|
-
// Unwrap paragraphs content, containing nothing usefull
|
1117
|
-
t.$ed.find('p').filter(function () {
|
1118
|
-
// Don't remove currently being edited element
|
1119
|
-
if (t.range && this === t.range.startContainer) {
|
1120
|
-
return false;
|
1121
|
-
}
|
1122
|
-
return $(this).text().trim().length === 0 && $(this).children().not('br,span').length === 0;
|
1123
|
-
}).contents().unwrap();
|
1191
|
+
t.semanticTag('div', true);
|
1124
1192
|
|
1125
|
-
// Get rid of
|
1193
|
+
// Get rid of temporary span's
|
1126
1194
|
$('[data-tbw]', t.$ed).contents().unwrap();
|
1127
1195
|
|
1128
1196
|
// Remove empty <p>
|
@@ -1137,9 +1205,23 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1137
1205
|
}
|
1138
1206
|
},
|
1139
1207
|
|
1140
|
-
semanticTag: function (oldTag,
|
1208
|
+
semanticTag: function (oldTag, copyAttributes) {
|
1209
|
+
var newTag;
|
1210
|
+
|
1211
|
+
if (this.o.semantic != null && typeof this.o.semantic === 'object' && this.o.semantic.hasOwnProperty(oldTag)) {
|
1212
|
+
newTag = this.o.semantic[oldTag];
|
1213
|
+
} else if (this.o.semantic === true && this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(oldTag)) {
|
1214
|
+
newTag = this.DEFAULT_SEMANTIC_MAP[oldTag];
|
1215
|
+
} else {
|
1216
|
+
return;
|
1217
|
+
}
|
1218
|
+
|
1141
1219
|
$(oldTag, this.$ed).each(function () {
|
1142
1220
|
var $oldTag = $(this);
|
1221
|
+
if($oldTag.contents().length === 0) {
|
1222
|
+
return false;
|
1223
|
+
}
|
1224
|
+
|
1143
1225
|
$oldTag.wrap('<' + newTag + '/>');
|
1144
1226
|
if (copyAttributes) {
|
1145
1227
|
$.each($oldTag.prop('attributes'), function () {
|
@@ -1154,7 +1236,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1154
1236
|
createLink: function () {
|
1155
1237
|
var t = this,
|
1156
1238
|
documentSelection = t.doc.getSelection(),
|
1239
|
+
selectedRange = documentSelection.getRangeAt(0),
|
1157
1240
|
node = documentSelection.focusNode,
|
1241
|
+
text = new XMLSerializer().serializeToString(selectedRange.cloneContents()) || selectedRange + '',
|
1158
1242
|
url,
|
1159
1243
|
title,
|
1160
1244
|
target;
|
@@ -1165,9 +1249,12 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1165
1249
|
|
1166
1250
|
if (node && node.nodeName === 'A') {
|
1167
1251
|
var $a = $(node);
|
1252
|
+
text = $a.text();
|
1168
1253
|
url = $a.attr('href');
|
1169
|
-
|
1170
|
-
|
1254
|
+
if (!t.o.minimalLinks) {
|
1255
|
+
title = $a.attr('title');
|
1256
|
+
target = $a.attr('target') || t.o.defaultLinkTarget;
|
1257
|
+
}
|
1171
1258
|
var range = t.doc.createRange();
|
1172
1259
|
range.selectNode(node);
|
1173
1260
|
documentSelection.removeAllRanges();
|
@@ -1176,37 +1263,69 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1176
1263
|
|
1177
1264
|
t.saveRange();
|
1178
1265
|
|
1179
|
-
|
1266
|
+
var options = {
|
1180
1267
|
url: {
|
1181
1268
|
label: 'URL',
|
1182
1269
|
required: true,
|
1183
1270
|
value: url
|
1184
1271
|
},
|
1185
|
-
title: {
|
1186
|
-
label: t.lang.title,
|
1187
|
-
value: title
|
1188
|
-
},
|
1189
1272
|
text: {
|
1190
1273
|
label: t.lang.text,
|
1191
|
-
value:
|
1192
|
-
}
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1274
|
+
value: text
|
1275
|
+
}
|
1276
|
+
};
|
1277
|
+
if (!t.o.minimalLinks) {
|
1278
|
+
$.extend(options, {
|
1279
|
+
title: {
|
1280
|
+
label: t.lang.title,
|
1281
|
+
value: title
|
1282
|
+
},
|
1283
|
+
target: {
|
1284
|
+
label: t.lang.target,
|
1285
|
+
value: target
|
1286
|
+
}
|
1287
|
+
});
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
t.openModalInsert(t.lang.createLink, options, function (v) { // v is value
|
1291
|
+
var url = t.prependUrlPrefix(v.url);
|
1292
|
+
if (!url.length) {
|
1293
|
+
return false;
|
1196
1294
|
}
|
1197
|
-
|
1198
|
-
var link = $(['<a href="',
|
1199
|
-
|
1295
|
+
|
1296
|
+
var link = $(['<a href="', url, '">', v.text || v.url, '</a>'].join(''));
|
1297
|
+
|
1298
|
+
if (v.title) {
|
1200
1299
|
link.attr('title', v.title);
|
1201
1300
|
}
|
1202
|
-
if (v.target
|
1203
|
-
link.attr('target', v.target);
|
1301
|
+
if (v.target || t.o.defaultLinkTarget) {
|
1302
|
+
link.attr('target', v.target || t.o.defaultLinkTarget);
|
1204
1303
|
}
|
1205
1304
|
t.range.deleteContents();
|
1206
1305
|
t.range.insertNode(link[0]);
|
1306
|
+
t.syncCode();
|
1307
|
+
t.$c.trigger('tbwchange');
|
1207
1308
|
return true;
|
1208
1309
|
});
|
1209
1310
|
},
|
1311
|
+
prependUrlPrefix: function (url) {
|
1312
|
+
var t = this;
|
1313
|
+
if (!t.urlPrefix) {
|
1314
|
+
return url;
|
1315
|
+
}
|
1316
|
+
|
1317
|
+
var VALID_LINK_PREFIX = /^([a-z][-+.a-z0-9]*:|\/|#)/i;
|
1318
|
+
if (VALID_LINK_PREFIX.test(url)) {
|
1319
|
+
return url;
|
1320
|
+
}
|
1321
|
+
|
1322
|
+
var SIMPLE_EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
1323
|
+
if (SIMPLE_EMAIL_REGEX.test(url)) {
|
1324
|
+
return 'mailto:' + url;
|
1325
|
+
}
|
1326
|
+
|
1327
|
+
return t.urlPrefix + url;
|
1328
|
+
},
|
1210
1329
|
unlink: function () {
|
1211
1330
|
var t = this,
|
1212
1331
|
documentSelection = t.doc.getSelection(),
|
@@ -1229,7 +1348,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1229
1348
|
insertImage: function () {
|
1230
1349
|
var t = this;
|
1231
1350
|
t.saveRange();
|
1232
|
-
|
1351
|
+
|
1352
|
+
var options = {
|
1233
1353
|
url: {
|
1234
1354
|
label: 'URL',
|
1235
1355
|
required: true
|
@@ -1238,9 +1358,26 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1238
1358
|
label: t.lang.description,
|
1239
1359
|
value: t.getRangeText()
|
1240
1360
|
}
|
1241
|
-
}
|
1242
|
-
|
1243
|
-
|
1361
|
+
};
|
1362
|
+
|
1363
|
+
if (t.o.imageWidthModalEdit) {
|
1364
|
+
options.width = {};
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
t.openModalInsert(t.lang.insertImage, options, function (v) { // v are values
|
1368
|
+
t.execCmd('insertImage', v.url, false, true);
|
1369
|
+
var $img = $('img[src="' + v.url + '"]:not([alt])', t.$box);
|
1370
|
+
$img.attr('alt', v.alt);
|
1371
|
+
|
1372
|
+
if (t.o.imageWidthModalEdit) {
|
1373
|
+
$img.attr({
|
1374
|
+
width: v.width
|
1375
|
+
});
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
t.syncCode();
|
1379
|
+
t.$c.trigger('tbwchange');
|
1380
|
+
|
1244
1381
|
return true;
|
1245
1382
|
});
|
1246
1383
|
},
|
@@ -1248,10 +1385,25 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1248
1385
|
var t = this,
|
1249
1386
|
prefix = t.o.prefix,
|
1250
1387
|
fullscreenCssClass = prefix + 'fullscreen',
|
1251
|
-
|
1388
|
+
fullscreenPlaceholderClass = fullscreenCssClass + '-placeholder',
|
1389
|
+
isFullscreen,
|
1390
|
+
editorHeight = t.$box.outerHeight();
|
1252
1391
|
|
1253
1392
|
t.$box.toggleClass(fullscreenCssClass);
|
1254
1393
|
isFullscreen = t.$box.hasClass(fullscreenCssClass);
|
1394
|
+
|
1395
|
+
if (isFullscreen) {
|
1396
|
+
t.$box.before(
|
1397
|
+
$('<div/>', {
|
1398
|
+
class: fullscreenPlaceholderClass
|
1399
|
+
}).css({
|
1400
|
+
height: editorHeight
|
1401
|
+
})
|
1402
|
+
);
|
1403
|
+
} else {
|
1404
|
+
$('.' + fullscreenPlaceholderClass).remove();
|
1405
|
+
}
|
1406
|
+
|
1255
1407
|
$('body').toggleClass(prefix + 'body-fullscreen', isFullscreen);
|
1256
1408
|
$(window).trigger('scroll');
|
1257
1409
|
t.$c.trigger('tbw' + (isFullscreen ? 'open' : 'close') + 'fullscreen');
|
@@ -1261,7 +1413,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1261
1413
|
/*
|
1262
1414
|
* Call method of trumbowyg if exist
|
1263
1415
|
* else try to call anonymous function
|
1264
|
-
* and
|
1416
|
+
* and finally native execCommand
|
1265
1417
|
*/
|
1266
1418
|
execCmd: function (cmd, param, forceCss, skipTrumbowyg) {
|
1267
1419
|
var t = this;
|
@@ -1303,10 +1455,12 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1303
1455
|
|
1304
1456
|
|
1305
1457
|
// Open a modal box
|
1306
|
-
openModal: function (title, content) {
|
1458
|
+
openModal: function (title, content, buildForm) {
|
1307
1459
|
var t = this,
|
1308
1460
|
prefix = t.o.prefix;
|
1309
1461
|
|
1462
|
+
buildForm = buildForm !== false;
|
1463
|
+
|
1310
1464
|
// No open a modal box when exist other modal box
|
1311
1465
|
if ($('.' + prefix + 'modal-box', t.$box).length > 0) {
|
1312
1466
|
return false;
|
@@ -1325,8 +1479,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1325
1479
|
var $modal = $('<div/>', {
|
1326
1480
|
class: prefix + 'modal ' + prefix + 'fixed-top'
|
1327
1481
|
}).css({
|
1328
|
-
top: t.$btnPane.height()
|
1329
|
-
|
1482
|
+
top: t.$box.offset().top + t.$btnPane.height(),
|
1483
|
+
zIndex: 99999
|
1484
|
+
}).appendTo($(t.doc.body));
|
1330
1485
|
|
1331
1486
|
// Click on overlay close modal by cancelling them
|
1332
1487
|
t.$overlay.one('click', function () {
|
@@ -1335,33 +1490,39 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1335
1490
|
});
|
1336
1491
|
|
1337
1492
|
// Build the form
|
1338
|
-
var
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
$modal.trigger(CONFIRM_EVENT);
|
1344
|
-
return false;
|
1345
|
-
})
|
1346
|
-
.on('reset', function () {
|
1347
|
-
$modal.trigger(CANCEL_EVENT);
|
1348
|
-
return false;
|
1493
|
+
var formOrContent;
|
1494
|
+
if (buildForm) {
|
1495
|
+
formOrContent = $('<form/>', {
|
1496
|
+
action: '',
|
1497
|
+
html: content
|
1349
1498
|
})
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1499
|
+
.on('submit', function () {
|
1500
|
+
$modal.trigger(CONFIRM_EVENT);
|
1501
|
+
return false;
|
1502
|
+
})
|
1503
|
+
.on('reset', function () {
|
1504
|
+
$modal.trigger(CANCEL_EVENT);
|
1505
|
+
return false;
|
1506
|
+
})
|
1507
|
+
.on('submit reset', function () {
|
1508
|
+
if (t.o.autogrowOnEnter) {
|
1509
|
+
t.autogrowOnEnterDontClose = false;
|
1510
|
+
}
|
1511
|
+
});
|
1512
|
+
} else {
|
1513
|
+
formOrContent = content;
|
1514
|
+
}
|
1355
1515
|
|
1356
1516
|
|
1357
1517
|
// Build ModalBox and animate to show them
|
1358
1518
|
var $box = $('<div/>', {
|
1359
1519
|
class: prefix + 'modal-box',
|
1360
|
-
html:
|
1520
|
+
html: formOrContent
|
1361
1521
|
})
|
1362
1522
|
.css({
|
1363
|
-
top: '-' + t.$btnPane.outerHeight()
|
1364
|
-
opacity: 0
|
1523
|
+
top: '-' + t.$btnPane.outerHeight(),
|
1524
|
+
opacity: 0,
|
1525
|
+
paddingBottom: buildForm ? null : '5%',
|
1365
1526
|
})
|
1366
1527
|
.appendTo($modal)
|
1367
1528
|
.animate({
|
@@ -1371,24 +1532,26 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1371
1532
|
|
1372
1533
|
|
1373
1534
|
// Append title
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
// Focus in modal box
|
1383
|
-
$('input:first', $box).focus();
|
1535
|
+
if (title) {
|
1536
|
+
$('<span/>', {
|
1537
|
+
text: title,
|
1538
|
+
class: prefix + 'modal-title'
|
1539
|
+
}).prependTo($box);
|
1540
|
+
}
|
1384
1541
|
|
1542
|
+
if (buildForm) {
|
1543
|
+
// Focus in modal box
|
1544
|
+
$('input:first', $box).focus();
|
1385
1545
|
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1546
|
+
// Append Confirm and Cancel buttons
|
1547
|
+
t.buildModalBtn('submit', $box);
|
1548
|
+
t.buildModalBtn('reset', $box);
|
1389
1549
|
|
1550
|
+
$modal.height($box.outerHeight() + 10);
|
1551
|
+
}
|
1390
1552
|
|
1391
1553
|
$(window).trigger('scroll');
|
1554
|
+
t.$c.trigger('tbwmodalopen');
|
1392
1555
|
|
1393
1556
|
return $modal;
|
1394
1557
|
},
|
@@ -1412,18 +1575,19 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1412
1575
|
t.$overlay.off();
|
1413
1576
|
|
1414
1577
|
// Find the modal box
|
1415
|
-
var $modalBox = $('.' + prefix + 'modal-box', t
|
1578
|
+
var $modalBox = $('.' + prefix + 'modal-box', $(t.doc.body));
|
1416
1579
|
|
1417
1580
|
$modalBox.animate({
|
1418
1581
|
top: '-' + $modalBox.height()
|
1419
1582
|
}, 100, function () {
|
1420
1583
|
$modalBox.parent().remove();
|
1421
1584
|
t.hideOverlay();
|
1585
|
+
t.$c.trigger('tbwmodalclose');
|
1422
1586
|
});
|
1423
1587
|
|
1424
1588
|
t.restoreRange();
|
1425
1589
|
},
|
1426
|
-
//
|
1590
|
+
// Pre-formatted build and management modal
|
1427
1591
|
openModalInsert: function (title, fields, cmd) {
|
1428
1592
|
var t = this,
|
1429
1593
|
prefix = t.o.prefix,
|
@@ -1431,7 +1595,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1431
1595
|
html = '';
|
1432
1596
|
|
1433
1597
|
$.each(fields, function (fieldName, field) {
|
1434
|
-
var l = field.label,
|
1598
|
+
var l = field.label || fieldName,
|
1435
1599
|
n = field.name || fieldName,
|
1436
1600
|
a = field.attributes || {};
|
1437
1601
|
|
@@ -1439,8 +1603,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1439
1603
|
return prop + '="' + a[prop] + '"';
|
1440
1604
|
}).join(' ');
|
1441
1605
|
|
1442
|
-
html += '<label><input type="' + (field.type || 'text') + '" name="' + n + '"
|
1443
|
-
(
|
1606
|
+
html += '<label><input type="' + (field.type || 'text') + '" name="' + n + '"' +
|
1607
|
+
(field.type === 'checkbox' && field.value ? ' checked="checked"' : ' value="' + (field.value || '').replace(/"/g, '"')) +
|
1608
|
+
'"' + attr + '><span class="' + prefix + 'input-infos"><span>' +
|
1609
|
+
(lg[l] ? lg[l] : l) +
|
1444
1610
|
'</span></span></label>';
|
1445
1611
|
});
|
1446
1612
|
|
@@ -1451,19 +1617,27 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1451
1617
|
values = {};
|
1452
1618
|
|
1453
1619
|
$.each(fields, function (fieldName, field) {
|
1454
|
-
var
|
1620
|
+
var n = field.name || fieldName;
|
1621
|
+
|
1622
|
+
var $field = $('input[name="' + n + '"]', $form),
|
1455
1623
|
inputType = $field.attr('type');
|
1456
1624
|
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1625
|
+
switch (inputType.toLowerCase()) {
|
1626
|
+
case 'checkbox':
|
1627
|
+
values[n] = $field.is(':checked');
|
1628
|
+
break;
|
1629
|
+
case 'radio':
|
1630
|
+
values[n] = $field.filter(':checked').val();
|
1631
|
+
break;
|
1632
|
+
default:
|
1633
|
+
values[n] = $.trim($field.val());
|
1634
|
+
break;
|
1461
1635
|
}
|
1462
1636
|
// Validate value
|
1463
|
-
if (field.required && values[
|
1637
|
+
if (field.required && values[n] === '') {
|
1464
1638
|
valid = false;
|
1465
1639
|
t.addErrorOnModalField($field, t.lang.required);
|
1466
|
-
} else if (field.pattern && !field.pattern.test(values[
|
1640
|
+
} else if (field.pattern && !field.pattern.test(values[n])) {
|
1467
1641
|
valid = false;
|
1468
1642
|
t.addErrorOnModalField($field, field.patternError);
|
1469
1643
|
}
|
@@ -1487,11 +1661,15 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1487
1661
|
},
|
1488
1662
|
addErrorOnModalField: function ($field, err) {
|
1489
1663
|
var prefix = this.o.prefix,
|
1664
|
+
spanErrorClass = prefix + 'msg-error',
|
1490
1665
|
$label = $field.parent();
|
1491
1666
|
|
1492
1667
|
$field
|
1493
1668
|
.on('change keyup', function () {
|
1494
1669
|
$label.removeClass(prefix + 'input-error');
|
1670
|
+
setTimeout(function () {
|
1671
|
+
$label.find('.' + spanErrorClass).remove();
|
1672
|
+
}, 150);
|
1495
1673
|
});
|
1496
1674
|
|
1497
1675
|
$label
|
@@ -1499,7 +1677,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1499
1677
|
.find('input+span')
|
1500
1678
|
.append(
|
1501
1679
|
$('<span/>', {
|
1502
|
-
class:
|
1680
|
+
class: spanErrorClass,
|
1503
1681
|
text: err
|
1504
1682
|
})
|
1505
1683
|
);
|
@@ -1517,7 +1695,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1517
1695
|
src = base64;
|
1518
1696
|
}
|
1519
1697
|
|
1520
|
-
|
1698
|
+
var options = {
|
1521
1699
|
url: {
|
1522
1700
|
label: 'URL',
|
1523
1701
|
value: src,
|
@@ -1527,15 +1705,34 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1527
1705
|
label: t.lang.description,
|
1528
1706
|
value: $img.attr('alt')
|
1529
1707
|
}
|
1530
|
-
}
|
1531
|
-
|
1708
|
+
};
|
1709
|
+
|
1710
|
+
if (t.o.imageWidthModalEdit) {
|
1711
|
+
options.width = {
|
1712
|
+
value: $img.attr('width') ? $img.attr('width') : ''
|
1713
|
+
};
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
t.openModalInsert(t.lang.insertImage, options, function (v) {
|
1717
|
+
if (v.url !== base64) {
|
1532
1718
|
$img.attr({
|
1533
|
-
src: v.
|
1719
|
+
src: v.url
|
1534
1720
|
});
|
1535
1721
|
}
|
1536
1722
|
$img.attr({
|
1537
1723
|
alt: v.alt
|
1538
1724
|
});
|
1725
|
+
|
1726
|
+
if (t.o.imageWidthModalEdit) {
|
1727
|
+
if (parseInt(v.width) > 0) {
|
1728
|
+
$img.attr({
|
1729
|
+
width: v.width
|
1730
|
+
});
|
1731
|
+
} else {
|
1732
|
+
$img.removeAttr('width');
|
1733
|
+
}
|
1734
|
+
}
|
1735
|
+
|
1539
1736
|
return true;
|
1540
1737
|
});
|
1541
1738
|
return false;
|
@@ -1549,18 +1746,20 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1549
1746
|
|
1550
1747
|
t.range = null;
|
1551
1748
|
|
1552
|
-
if (documentSelection.rangeCount) {
|
1553
|
-
|
1554
|
-
range = t.doc.createRange(),
|
1555
|
-
rangeStart;
|
1556
|
-
range.selectNodeContents(t.$ed[0]);
|
1557
|
-
range.setEnd(savedRange.startContainer, savedRange.startOffset);
|
1558
|
-
rangeStart = (range + '').length;
|
1559
|
-
t.metaRange = {
|
1560
|
-
start: rangeStart,
|
1561
|
-
end: rangeStart + (savedRange + '').length
|
1562
|
-
};
|
1749
|
+
if (!documentSelection || !documentSelection.rangeCount) {
|
1750
|
+
return;
|
1563
1751
|
}
|
1752
|
+
|
1753
|
+
var savedRange = t.range = documentSelection.getRangeAt(0),
|
1754
|
+
range = t.doc.createRange(),
|
1755
|
+
rangeStart;
|
1756
|
+
range.selectNodeContents(t.$ed[0]);
|
1757
|
+
range.setEnd(savedRange.startContainer, savedRange.startOffset);
|
1758
|
+
rangeStart = (range + '').length;
|
1759
|
+
t.metaRange = {
|
1760
|
+
start: rangeStart,
|
1761
|
+
end: rangeStart + (savedRange + '').length
|
1762
|
+
};
|
1564
1763
|
},
|
1565
1764
|
restoreRange: function () {
|
1566
1765
|
var t = this,
|
@@ -1606,20 +1805,40 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1606
1805
|
}
|
1607
1806
|
}
|
1608
1807
|
|
1609
|
-
|
1808
|
+
// Fix IE11 Error 'Could not complete the operation due to error 800a025e'.
|
1809
|
+
// https://stackoverflow.com/questions/16160996/could-not-complete-the-operation-due-to-error-800a025e
|
1810
|
+
try {
|
1811
|
+
documentSelection.removeAllRanges();
|
1812
|
+
} catch (e) {
|
1813
|
+
}
|
1814
|
+
|
1610
1815
|
documentSelection.addRange(range || savedRange);
|
1611
1816
|
},
|
1612
1817
|
getRangeText: function () {
|
1613
1818
|
return this.range + '';
|
1614
1819
|
},
|
1615
1820
|
|
1821
|
+
clearButtonPaneStatus: function () {
|
1822
|
+
var t = this,
|
1823
|
+
prefix = t.o.prefix,
|
1824
|
+
activeClasses = prefix + 'active-button ' + prefix + 'active',
|
1825
|
+
originalIconClass = prefix + 'original-icon';
|
1826
|
+
|
1827
|
+
// Reset all buttons and dropdown state
|
1828
|
+
$('.' + prefix + 'active-button', t.$btnPane).removeClass(activeClasses);
|
1829
|
+
$('.' + originalIconClass, t.$btnPane).each(function () {
|
1830
|
+
$(this).find('svg use').attr('xlink:href', $(this).data(originalIconClass));
|
1831
|
+
});
|
1832
|
+
},
|
1616
1833
|
updateButtonPaneStatus: function () {
|
1617
1834
|
var t = this,
|
1618
1835
|
prefix = t.o.prefix,
|
1619
|
-
|
1620
|
-
|
1836
|
+
activeClasses = prefix + 'active-button ' + prefix + 'active',
|
1837
|
+
originalIconClass = prefix + 'original-icon',
|
1838
|
+
tags = t.getTagsRecursive(t.doc.getSelection().focusNode);
|
1839
|
+
|
1840
|
+
t.clearButtonPaneStatus();
|
1621
1841
|
|
1622
|
-
$('.' + prefix + 'active-button', t.$btnPane).removeClass(activeClasses);
|
1623
1842
|
$.each(tags, function (i, tag) {
|
1624
1843
|
var btnName = t.tagToButton[tag.toLowerCase()],
|
1625
1844
|
$btn = $('.' + prefix + btnName + '-button', t.$btnPane);
|
@@ -1629,8 +1848,25 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1629
1848
|
} else {
|
1630
1849
|
try {
|
1631
1850
|
$btn = $('.' + prefix + 'dropdown .' + prefix + btnName + '-dropdown-button', t.$box);
|
1632
|
-
var
|
1633
|
-
|
1851
|
+
var $btnSvgUse = $btn.find('svg use'),
|
1852
|
+
dropdownBtnName = $btn.parent().data(prefix + 'dropdown'),
|
1853
|
+
$dropdownBtn = $('.' + prefix + dropdownBtnName + '-button', t.$box),
|
1854
|
+
$dropdownBtnSvgUse = $dropdownBtn.find('svg use');
|
1855
|
+
|
1856
|
+
// Highlight the dropdown button
|
1857
|
+
$dropdownBtn.addClass(activeClasses);
|
1858
|
+
|
1859
|
+
// Switch dropdown icon to the active sub-icon one
|
1860
|
+
if (t.o.changeActiveDropdownIcon && $btnSvgUse.length > 0) {
|
1861
|
+
// Save original icon
|
1862
|
+
$dropdownBtn
|
1863
|
+
.addClass(originalIconClass)
|
1864
|
+
.data(originalIconClass, $dropdownBtnSvgUse.attr('xlink:href'));
|
1865
|
+
|
1866
|
+
// Put the active sub-button's icon
|
1867
|
+
$dropdownBtnSvgUse
|
1868
|
+
.attr('xlink:href', $btnSvgUse.attr('xlink:href'));
|
1869
|
+
}
|
1634
1870
|
} catch (e) {
|
1635
1871
|
}
|
1636
1872
|
}
|
@@ -1660,7 +1896,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1660
1896
|
|
1661
1897
|
tags.push(tag);
|
1662
1898
|
|
1663
|
-
return t.getTagsRecursive(element, tags).filter(function(tag) {
|
1899
|
+
return t.getTagsRecursive(element, tags).filter(function (tag) {
|
1900
|
+
return tag != null;
|
1901
|
+
});
|
1664
1902
|
},
|
1665
1903
|
|
1666
1904
|
// Plugins
|
@@ -1678,9 +1916,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1678
1916
|
});
|
1679
1917
|
},
|
1680
1918
|
destroyPlugins: function () {
|
1919
|
+
var t = this;
|
1681
1920
|
$.each(this.loadedPlugins, function (i, plugin) {
|
1682
1921
|
if (plugin.destroy) {
|
1683
|
-
plugin.destroy();
|
1922
|
+
plugin.destroy(t);
|
1684
1923
|
}
|
1685
1924
|
});
|
1686
1925
|
}
|