esp-ckeditor 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +32 -0
- data/Rakefile +28 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/_bootstrap.js +87 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/ckeditor.js +141 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/ckeditor_base.js +227 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/ckeditor_basic.js +238 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/command.js +209 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/commanddefinition.js +129 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/config.js +423 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dataprocessor.js +65 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/comment.js +32 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/document.js +251 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/documentfragment.js +49 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/domobject.js +258 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/element.js +1691 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/elementpath.js +119 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/event.js +145 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/node.js +696 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/nodelist.js +26 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/range.js +2054 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/rangelist.js +213 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/text.js +128 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/walker.js +462 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom/window.js +96 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dom.js +20 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/dtd.js +266 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/editor.js +1060 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/editor_basic.js +186 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/env.js +305 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/event.js +342 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/eventInfo.js +120 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/focusmanager.js +152 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/basicwriter.js +145 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/cdata.js +43 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/comment.js +60 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/element.js +308 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/filter.js +288 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/fragment.js +518 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser/text.js +53 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/htmlparser.js +224 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/lang.js +157 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/loader.js +240 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/plugindefinition.js +83 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/plugins.js +103 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/resourcemanager.js +238 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/scriptloader.js +180 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/skins.js +184 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/themes.js +19 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/tools.js +763 -0
- data/app/assets/javascripts/esp-ckeditor/_source/core/ui.js +128 -0
- data/app/assets/javascripts/esp-ckeditor/_source/lang/_languages.js +27 -0
- data/app/assets/javascripts/esp-ckeditor/_source/lang/en.js +815 -0
- data/app/assets/javascripts/esp-ckeditor/_source/lang/ru.js +815 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/dialogs/a11yhelp.js +222 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/lang/en.js +108 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/lang/he.js +216 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/a11yhelp/plugin.js +47 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/basicstyles/plugin.js +129 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/button/plugin.js +290 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/clipboard/dialogs/paste.js +223 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/clipboard/plugin.js +453 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/contextmenu/plugin.js +179 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialog/dialogDefinition.js +1166 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialog/plugin.js +3308 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialogadvtab/plugin.js +208 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/dialogui/plugin.js +1541 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/domiterator/plugin.js +361 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/editingblock/plugin.js +278 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/elementspath/plugin.js +218 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/enterkey/plugin.js +433 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/entities/plugin.js +250 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/dialogs/esp_attachment.js +234 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/images/esp_attachment.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/lang/en.js +22 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/lang/ru.js +22 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/lang/uk.js +22 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_attachment/plugin.js +23 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/dialogs/esp_audio.js +207 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/images/esp_audio.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/images/placeholder.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/lang/en.js +18 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/lang/ru.js +18 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/lang/uk.js +18 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_audio/plugin.js +182 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_blockquote/dialogs/esp_blockquote.js +132 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_blockquote/plugin.js +235 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/dialogs/esp_image.js +1414 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/images/esp_image.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/lang/en.js +9 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/lang/ru.js +9 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/lang/uk.js +9 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_image/plugin.js +80 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/dialogs/esp_anchor.js +145 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/dialogs/esp_link.js +1396 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/anchor.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/esp_anchor.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/esp_link.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/images/esp_unlink.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/lang/en.js +8 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/lang/ru.js +8 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/lang/uk.js +8 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_link/plugin.js +379 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_address.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_blockquote.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_div.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h1.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h2.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h3.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h4.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h5.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_h6.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_p.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/block_pre.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/images/esp_showblocks.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_showblocks/plugin.js +163 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/dialogs/esp_video.js +277 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/images/esp_video.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/images/placeholder.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/lang/en.js +19 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/lang/ru.js +19 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/lang/uk.js +19 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_video/plugin.js +182 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/fakeobjects/plugin.js +175 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/filebrowser/plugin.js +534 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/find/dialogs/find.js +915 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/find/plugin.js +47 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/floatpanel/plugin.js +428 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/format/plugin.js +197 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/htmldataprocessor/plugin.js +596 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/htmlwriter/plugin.js +319 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/image/dialogs/image.js +1407 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/image/plugin.js +81 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/indent/plugin.js +461 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/justify/plugin.js +253 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/keystrokes/plugin.js +225 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/list/plugin.js +774 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/listblock/plugin.js +266 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/liststyle/dialogs/liststyle.js +225 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/liststyle/plugin.js +66 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/maximize/plugin.js +353 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/menu/plugin.js +541 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/panel/plugin.js +400 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastefromword/filter/default.js +1367 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastefromword/plugin.js +141 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastetext/dialogs/pastetext.js +67 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/pastetext/plugin.js +98 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/popup/plugin.js +64 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/removeformat/plugin.js +185 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/resize/plugin.js +168 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/richcombo/plugin.js +381 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/selection/plugin.js +1729 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/showborders/plugin.js +207 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/sourcearea/plugin.js +209 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/styles/plugin.js +1700 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/styles/styles/default.js +88 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/stylescombo/plugin.js +218 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/tab/plugin.js +367 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/table/dialogs/table.js +623 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/table/plugin.js +78 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/tabletools/dialogs/tableCell.js +525 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/tabletools/plugin.js +1194 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/toolbar/plugin.js +545 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/undo/plugin.js +578 -0
- data/app/assets/javascripts/esp-ckeditor/_source/plugins/wysiwygarea/plugin.js +1347 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/dialog.css +988 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/editor.css +25 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/elementspath.css +73 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/icons.css +367 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/icons.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/icons_rtl.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/dialog_sides.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/dialog_sides.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/dialog_sides_rtl.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/mini.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/noimage.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/sprites.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/sprites_ie6.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/images/toolbar_start.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/mainui.css +209 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/menu.css +232 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/panel.css +227 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/presets.css +49 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/reset.css +85 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/richcombo.css +287 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/skin.js +236 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/templates.css +88 -0
- data/app/assets/javascripts/esp-ckeditor/_source/skins/kama/toolbar.css +412 -0
- data/app/assets/javascripts/esp-ckeditor/_source/themes/default/theme.js +407 -0
- data/app/assets/javascripts/esp-ckeditor/application.js +8 -0
- data/app/assets/javascripts/esp-ckeditor/ckeditor.js +137 -0
- data/app/assets/javascripts/esp-ckeditor/ckeditor.pack +194 -0
- data/app/assets/javascripts/esp-ckeditor/ckeditor_source.js +35 -0
- data/app/assets/javascripts/esp-ckeditor/ckpackager.jar +0 -0
- data/app/assets/javascripts/esp-ckeditor/ckpackager.txt +2 -0
- data/app/assets/javascripts/esp-ckeditor/config.js +147 -0
- data/app/assets/javascripts/esp-ckeditor/contents.css +38 -0
- data/app/assets/javascripts/esp-ckeditor/images/spacer.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/init_ckeditor.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/lang/en.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/lang/he.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/a11yhelp/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/basicstyles/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/button/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/clipboard/dialogs/paste.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/clipboard/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/contextmenu/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/dialog/dialogDefinition.js +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/dialog/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/dialogadvtab/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/dialogui/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/domiterator/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/editingblock/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/elementspath/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/enterkey/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/entities/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/dialogs/esp_attachment.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/images/esp_attachment.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/lang/en.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/lang/ru.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/lang/uk.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_attachment/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/dialogs/esp_audio.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/images/esp_audio.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/images/placeholder.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/lang/en.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/lang/ru.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/lang/uk.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_audio/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_blockquote/dialogs/esp_blockquote.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_blockquote/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/dialogs/esp_image.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/images/esp_image.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/lang/en.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/lang/ru.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/lang/uk.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_image/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/dialogs/esp_anchor.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/dialogs/esp_link.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/anchor.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/esp_anchor.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/esp_link.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/images/esp_unlink.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/lang/en.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/lang/ru.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/lang/uk.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_link/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_address.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_blockquote.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_div.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h1.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h2.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h3.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h4.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h5.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_h6.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_p.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/block_pre.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/images/esp_showblocks.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_showblocks/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/dialogs/esp_video.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/images/esp_video.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/images/placeholder.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/lang/en.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/lang/ru.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/lang/uk.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/esp_video/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/fakeobjects/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/filebrowser/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/find/dialogs/find.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/find/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/floatpanel/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/format/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/htmldataprocessor/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/htmlwriter/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/image/dialogs/image.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/image/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/indent/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/justify/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/keystrokes/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/list/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/listblock/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/liststyle/dialogs/liststyle.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/liststyle/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/maximize/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/menu/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/panel/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/pastefromword/filter/default.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/pastefromword/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/pastetext/dialogs/pastetext.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/pastetext/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/popup/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/removeformat/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/resize/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/richcombo/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/selection/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/showborders/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/sourcearea/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/styles/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/styles/styles/default.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/stylescombo/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/tab/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/table/dialogs/table.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/table/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/tabletools/dialogs/tableCell.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/tabletools/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/toolbar/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/undo/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/plugins/wysiwygarea/plugin.js +1 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/dialog.css +988 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/editor.css +25 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/elementspath.css +73 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/icons.css +367 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/icons.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/icons_rtl.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/dialog_sides.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/dialog_sides.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/mini.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/noimage.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/sprites.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/sprites_ie6.png +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/images/toolbar_start.gif +0 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/mainui.css +209 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/menu.css +232 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/panel.css +227 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/presets.css +49 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/reset.css +85 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/richcombo.css +287 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/skin.js +236 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/templates.css +88 -0
- data/app/assets/javascripts/esp-ckeditor/skins/kama/toolbar.css +412 -0
- data/app/inputs/ckeditor_input.rb +42 -0
- data/config/routes.rb +2 -0
- data/lib/esp-ckeditor/engine.rb +9 -0
- data/lib/esp-ckeditor/version.rb +3 -0
- data/lib/esp-ckeditor.rb +17 -0
- data/lib/tasks/esp-ckeditor_tasks.rake +4 -0
- metadata +434 -0
data/app/assets/javascripts/esp-ckeditor/_source/plugins/esp_blockquote/dialogs/esp_blockquote.js
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
(function () {
|
2
|
+
CKEDITOR.dialog.add('esp_blockquote', function (editor) {
|
3
|
+
|
4
|
+
function commitKlass()
|
5
|
+
{
|
6
|
+
};
|
7
|
+
|
8
|
+
function loadKlass()
|
9
|
+
{
|
10
|
+
};
|
11
|
+
|
12
|
+
return {
|
13
|
+
title : 'Class for Blockquote',
|
14
|
+
minWidth : 200,
|
15
|
+
minHeight : 50,
|
16
|
+
|
17
|
+
onShow : function()
|
18
|
+
{
|
19
|
+
},
|
20
|
+
|
21
|
+
onOk : function()
|
22
|
+
{
|
23
|
+
var selection = editor.getSelection(),
|
24
|
+
range = selection && selection.getRanges( true )[0],
|
25
|
+
iterator = range.createIterator();
|
26
|
+
|
27
|
+
var paragraphs = [];
|
28
|
+
while ( ( block = iterator.getNextParagraph() ) )
|
29
|
+
paragraphs.push( block );
|
30
|
+
|
31
|
+
// If no paragraphs, create one from the current selection position.
|
32
|
+
if ( paragraphs.length < 1 )
|
33
|
+
{
|
34
|
+
var para = editor.document.createElement( editor.config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ),
|
35
|
+
firstBookmark = bookmarks.shift();
|
36
|
+
range.insertNode( para );
|
37
|
+
para.append( new CKEDITOR.dom.text( '\ufeff', editor.document ) );
|
38
|
+
range.moveToBookmark( firstBookmark );
|
39
|
+
range.selectNodeContents( para );
|
40
|
+
range.collapse( true );
|
41
|
+
firstBookmark = range.createBookmark();
|
42
|
+
paragraphs.push( para );
|
43
|
+
bookmarks.unshift( firstBookmark );
|
44
|
+
}
|
45
|
+
|
46
|
+
// Make sure all paragraphs have the same parent.
|
47
|
+
var commonParent = paragraphs[0].getParent(),
|
48
|
+
tmp = [];
|
49
|
+
for ( var i = 0 ; i < paragraphs.length ; i++ )
|
50
|
+
{
|
51
|
+
block = paragraphs[i];
|
52
|
+
commonParent = commonParent.getCommonAncestor( block.getParent() );
|
53
|
+
}
|
54
|
+
|
55
|
+
// The common parent must not be the following tags: table, tbody, tr, ol, ul.
|
56
|
+
var denyTags = { table : 1, tbody : 1, tr : 1, ol : 1, ul : 1 };
|
57
|
+
while ( denyTags[ commonParent.getName() ] )
|
58
|
+
commonParent = commonParent.getParent();
|
59
|
+
|
60
|
+
// Reconstruct the block list to be processed such that all resulting blocks
|
61
|
+
// satisfy parentNode.equals( commonParent ).
|
62
|
+
var lastBlock = null;
|
63
|
+
while ( paragraphs.length > 0 )
|
64
|
+
{
|
65
|
+
block = paragraphs.shift();
|
66
|
+
while ( !block.getParent().equals( commonParent ) )
|
67
|
+
block = block.getParent();
|
68
|
+
if ( !block.equals( lastBlock ) )
|
69
|
+
tmp.push( block );
|
70
|
+
lastBlock = block;
|
71
|
+
}
|
72
|
+
|
73
|
+
// If any of the selected blocks is a blockquote, remove it to prevent
|
74
|
+
// nested blockquotes.
|
75
|
+
while ( tmp.length > 0 )
|
76
|
+
{
|
77
|
+
block = tmp.shift();
|
78
|
+
if ( block.getName() == 'blockquote' )
|
79
|
+
{
|
80
|
+
var docFrag = new CKEDITOR.dom.documentFragment( editor.document );
|
81
|
+
while ( block.getFirst() )
|
82
|
+
{
|
83
|
+
docFrag.append( block.getFirst().remove() );
|
84
|
+
paragraphs.push( docFrag.getLast() );
|
85
|
+
}
|
86
|
+
|
87
|
+
docFrag.replace( block );
|
88
|
+
}
|
89
|
+
else
|
90
|
+
paragraphs.push( block );
|
91
|
+
}
|
92
|
+
|
93
|
+
// Now we have all the blocks to be included in a new blockquote node.
|
94
|
+
var bqBlock = editor.document.createElement( 'blockquote' );
|
95
|
+
var newKlass = this.getValueOf( 'info', 'klass0');
|
96
|
+
if ( newKlass ) {
|
97
|
+
bqBlock.setAttribute("class", newKlass); //For Most Browsers
|
98
|
+
if ( CKEDITOR.env.ie ) {
|
99
|
+
bqBlock.setAttribute("className", newKlass); //For IE; harmless to other browsers.
|
100
|
+
};
|
101
|
+
};
|
102
|
+
bqBlock.insertBefore( paragraphs[0] );
|
103
|
+
while ( paragraphs.length > 0 )
|
104
|
+
{
|
105
|
+
block = paragraphs.shift();
|
106
|
+
bqBlock.append( block );
|
107
|
+
}
|
108
|
+
},
|
109
|
+
|
110
|
+
onHide : function()
|
111
|
+
{
|
112
|
+
},
|
113
|
+
|
114
|
+
contents :
|
115
|
+
[
|
116
|
+
{
|
117
|
+
id : 'info',
|
118
|
+
elements :
|
119
|
+
[
|
120
|
+
{
|
121
|
+
type : 'text',
|
122
|
+
id : 'klass0',
|
123
|
+
label : 'Class',
|
124
|
+
commit : commitKlass,
|
125
|
+
setup : loadKlass
|
126
|
+
}
|
127
|
+
]
|
128
|
+
}
|
129
|
+
]
|
130
|
+
};
|
131
|
+
})
|
132
|
+
})();
|
@@ -0,0 +1,235 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @file Blockquote.
|
8
|
+
*/
|
9
|
+
|
10
|
+
(function()
|
11
|
+
{
|
12
|
+
function getState( editor, path )
|
13
|
+
{
|
14
|
+
var firstBlock = path.block || path.blockLimit;
|
15
|
+
|
16
|
+
if ( !firstBlock || firstBlock.getName() == 'body' )
|
17
|
+
return CKEDITOR.TRISTATE_OFF;
|
18
|
+
|
19
|
+
// See if the first block has a blockquote parent.
|
20
|
+
if ( firstBlock.getAscendant( 'blockquote', true ) )
|
21
|
+
return CKEDITOR.TRISTATE_ON;
|
22
|
+
|
23
|
+
return CKEDITOR.TRISTATE_OFF;
|
24
|
+
}
|
25
|
+
|
26
|
+
function onSelectionChange( evt )
|
27
|
+
{
|
28
|
+
var editor = evt.editor;
|
29
|
+
if ( editor.readOnly )
|
30
|
+
return;
|
31
|
+
|
32
|
+
var command = editor.getCommand( 'esp_blockquote' );
|
33
|
+
command.state = getState( editor, evt.data.path );
|
34
|
+
command.fire( 'state' );
|
35
|
+
}
|
36
|
+
|
37
|
+
function noBlockLeft( bqBlock )
|
38
|
+
{
|
39
|
+
for ( var i = 0, length = bqBlock.getChildCount(), child ; i < length && ( child = bqBlock.getChild( i ) ) ; i++ )
|
40
|
+
{
|
41
|
+
if ( child.type == CKEDITOR.NODE_ELEMENT && child.isBlockBoundary() )
|
42
|
+
return false;
|
43
|
+
}
|
44
|
+
return true;
|
45
|
+
}
|
46
|
+
|
47
|
+
var commandObject =
|
48
|
+
{
|
49
|
+
exec : function( editor )
|
50
|
+
{
|
51
|
+
var state = editor.getCommand( 'esp_blockquote' ).state,
|
52
|
+
selection = editor.getSelection(),
|
53
|
+
range = selection && selection.getRanges( true )[0];
|
54
|
+
|
55
|
+
if ( !range )
|
56
|
+
return;
|
57
|
+
|
58
|
+
var bookmarks = selection.createBookmarks();
|
59
|
+
|
60
|
+
// Kludge for #1592: if the bookmark nodes are in the beginning of
|
61
|
+
// blockquote, then move them to the nearest block element in the
|
62
|
+
// blockquote.
|
63
|
+
if ( CKEDITOR.env.ie )
|
64
|
+
{
|
65
|
+
var bookmarkStart = bookmarks[0].startNode,
|
66
|
+
bookmarkEnd = bookmarks[0].endNode,
|
67
|
+
cursor;
|
68
|
+
|
69
|
+
if ( bookmarkStart && bookmarkStart.getParent().getName() == 'blockquote' )
|
70
|
+
{
|
71
|
+
cursor = bookmarkStart;
|
72
|
+
while ( ( cursor = cursor.getNext() ) )
|
73
|
+
{
|
74
|
+
if ( cursor.type == CKEDITOR.NODE_ELEMENT &&
|
75
|
+
cursor.isBlockBoundary() )
|
76
|
+
{
|
77
|
+
bookmarkStart.move( cursor, true );
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
if ( bookmarkEnd
|
84
|
+
&& bookmarkEnd.getParent().getName() == 'blockquote' )
|
85
|
+
{
|
86
|
+
cursor = bookmarkEnd;
|
87
|
+
while ( ( cursor = cursor.getPrevious() ) )
|
88
|
+
{
|
89
|
+
if ( cursor.type == CKEDITOR.NODE_ELEMENT &&
|
90
|
+
cursor.isBlockBoundary() )
|
91
|
+
{
|
92
|
+
bookmarkEnd.move( cursor );
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
var iterator = range.createIterator(),
|
100
|
+
block;
|
101
|
+
|
102
|
+
iterator.enlargeBr = editor.config.enterMode != CKEDITOR.ENTER_BR;
|
103
|
+
|
104
|
+
if ( state == CKEDITOR.TRISTATE_OFF )
|
105
|
+
{
|
106
|
+
editor.openDialog('esp_blockquote');
|
107
|
+
}
|
108
|
+
else if ( state == CKEDITOR.TRISTATE_ON )
|
109
|
+
{
|
110
|
+
var moveOutNodes = [],
|
111
|
+
database = {};
|
112
|
+
|
113
|
+
while ( ( block = iterator.getNextParagraph() ) )
|
114
|
+
{
|
115
|
+
var bqParent = null,
|
116
|
+
bqChild = null;
|
117
|
+
while ( block.getParent() )
|
118
|
+
{
|
119
|
+
if ( block.getParent().getName() == 'blockquote' )
|
120
|
+
{
|
121
|
+
bqParent = block.getParent();
|
122
|
+
bqChild = block;
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
block = block.getParent();
|
126
|
+
}
|
127
|
+
|
128
|
+
// Remember the blocks that were recorded down in the moveOutNodes array
|
129
|
+
// to prevent duplicates.
|
130
|
+
if ( bqParent && bqChild && !bqChild.getCustomData( 'blockquote_moveout' ) )
|
131
|
+
{
|
132
|
+
moveOutNodes.push( bqChild );
|
133
|
+
CKEDITOR.dom.element.setMarker( database, bqChild, 'blockquote_moveout', true );
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
CKEDITOR.dom.element.clearAllMarkers( database );
|
138
|
+
|
139
|
+
var movedNodes = [],
|
140
|
+
processedBlockquoteBlocks = [];
|
141
|
+
|
142
|
+
database = {};
|
143
|
+
while ( moveOutNodes.length > 0 )
|
144
|
+
{
|
145
|
+
var node = moveOutNodes.shift();
|
146
|
+
bqBlock = node.getParent();
|
147
|
+
|
148
|
+
// If the node is located at the beginning or the end, just take it out
|
149
|
+
// without splitting. Otherwise, split the blockquote node and move the
|
150
|
+
// paragraph in between the two blockquote nodes.
|
151
|
+
if ( !node.getPrevious() )
|
152
|
+
node.remove().insertBefore( bqBlock );
|
153
|
+
else if ( !node.getNext() )
|
154
|
+
node.remove().insertAfter( bqBlock );
|
155
|
+
else
|
156
|
+
{
|
157
|
+
node.breakParent( node.getParent() );
|
158
|
+
processedBlockquoteBlocks.push( node.getNext() );
|
159
|
+
}
|
160
|
+
|
161
|
+
// Remember the blockquote node so we can clear it later (if it becomes empty).
|
162
|
+
if ( !bqBlock.getCustomData( 'blockquote_processed' ) )
|
163
|
+
{
|
164
|
+
processedBlockquoteBlocks.push( bqBlock );
|
165
|
+
CKEDITOR.dom.element.setMarker( database, bqBlock, 'blockquote_processed', true );
|
166
|
+
}
|
167
|
+
|
168
|
+
movedNodes.push( node );
|
169
|
+
}
|
170
|
+
|
171
|
+
CKEDITOR.dom.element.clearAllMarkers( database );
|
172
|
+
|
173
|
+
// Clear blockquote nodes that have become empty.
|
174
|
+
for ( i = processedBlockquoteBlocks.length - 1 ; i >= 0 ; i-- )
|
175
|
+
{
|
176
|
+
bqBlock = processedBlockquoteBlocks[i];
|
177
|
+
if ( noBlockLeft( bqBlock ) )
|
178
|
+
bqBlock.remove();
|
179
|
+
}
|
180
|
+
|
181
|
+
if ( editor.config.enterMode == CKEDITOR.ENTER_BR )
|
182
|
+
{
|
183
|
+
var firstTime = true;
|
184
|
+
while ( movedNodes.length )
|
185
|
+
{
|
186
|
+
node = movedNodes.shift();
|
187
|
+
|
188
|
+
if ( node.getName() == 'div' )
|
189
|
+
{
|
190
|
+
docFrag = new CKEDITOR.dom.documentFragment( editor.document );
|
191
|
+
var needBeginBr = firstTime && node.getPrevious() &&
|
192
|
+
!( node.getPrevious().type == CKEDITOR.NODE_ELEMENT && node.getPrevious().isBlockBoundary() );
|
193
|
+
if ( needBeginBr )
|
194
|
+
docFrag.append( editor.document.createElement( 'br' ) );
|
195
|
+
|
196
|
+
var needEndBr = node.getNext() &&
|
197
|
+
!( node.getNext().type == CKEDITOR.NODE_ELEMENT && node.getNext().isBlockBoundary() );
|
198
|
+
while ( node.getFirst() )
|
199
|
+
node.getFirst().remove().appendTo( docFrag );
|
200
|
+
|
201
|
+
if ( needEndBr )
|
202
|
+
docFrag.append( editor.document.createElement( 'br' ) );
|
203
|
+
|
204
|
+
docFrag.replace( node );
|
205
|
+
firstTime = false;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
selection.selectBookmarks( bookmarks );
|
212
|
+
editor.focus();
|
213
|
+
}
|
214
|
+
};
|
215
|
+
|
216
|
+
CKEDITOR.plugins.add( 'esp_blockquote',
|
217
|
+
{
|
218
|
+
init : function( editor )
|
219
|
+
{
|
220
|
+
var commandName = 'esp_blockquote';
|
221
|
+
editor.addCommand( commandName, commandObject );
|
222
|
+
|
223
|
+
editor.ui.addButton( 'Esp_Blockquote',
|
224
|
+
{
|
225
|
+
label : editor.lang.blockquote,
|
226
|
+
command : commandName
|
227
|
+
} );
|
228
|
+
|
229
|
+
editor.on( 'selectionChange', onSelectionChange );
|
230
|
+
CKEDITOR.dialog.add(commandName, CKEDITOR.getUrl(this.path + 'dialogs/esp_blockquote.js'))
|
231
|
+
},
|
232
|
+
|
233
|
+
requires : [ 'domiterator' ]
|
234
|
+
} );
|
235
|
+
})();
|
@@ -0,0 +1,1414 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
(function()
|
7
|
+
{
|
8
|
+
var esp_imageDialog = function( editor, dialogType )
|
9
|
+
{
|
10
|
+
// Load image preview.
|
11
|
+
var IMAGE = 1,
|
12
|
+
LINK = 2,
|
13
|
+
PREVIEW = 4,
|
14
|
+
CLEANUP = 8,
|
15
|
+
regexGetSize = /^\s*(\d+)((px)|\%)?\s*$/i,
|
16
|
+
regexGetSizeOrEmpty = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i,
|
17
|
+
pxLengthRegex = /^\d+px$/;
|
18
|
+
|
19
|
+
var onSizeChange = function()
|
20
|
+
{
|
21
|
+
var value = this.getValue(), // This = input element.
|
22
|
+
dialog = this.getDialog(),
|
23
|
+
aMatch = value.match( regexGetSize ); // Check value
|
24
|
+
if ( aMatch )
|
25
|
+
{
|
26
|
+
if ( aMatch[2] == '%' ) // % is allowed - > unlock ratio.
|
27
|
+
switchLockRatio( dialog, false ); // Unlock.
|
28
|
+
value = aMatch[1];
|
29
|
+
}
|
30
|
+
|
31
|
+
// Only if ratio is locked
|
32
|
+
if ( dialog.lockRatio )
|
33
|
+
{
|
34
|
+
var oImageOriginal = dialog.originalElement;
|
35
|
+
if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
|
36
|
+
{
|
37
|
+
if ( this.id == 'txtHeight' )
|
38
|
+
{
|
39
|
+
if ( value && value != '0' )
|
40
|
+
value = Math.round( oImageOriginal.$.width * ( value / oImageOriginal.$.height ) );
|
41
|
+
if ( !isNaN( value ) )
|
42
|
+
dialog.setValueOf( 'info', 'txtWidth', value );
|
43
|
+
}
|
44
|
+
else //this.id = txtWidth.
|
45
|
+
{
|
46
|
+
if ( value && value != '0' )
|
47
|
+
value = Math.round( oImageOriginal.$.height * ( value / oImageOriginal.$.width ) );
|
48
|
+
if ( !isNaN( value ) )
|
49
|
+
dialog.setValueOf( 'info', 'txtHeight', value );
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
updatePreview( dialog );
|
54
|
+
};
|
55
|
+
|
56
|
+
var changeImageUrl = function( dialog, mode )
|
57
|
+
{
|
58
|
+
if ( mode == 'onOk' ) {
|
59
|
+
var width = dialog.getValueOf( 'info', 'txtWidth' );
|
60
|
+
var height = dialog.getValueOf( 'info', 'txtHeight' );
|
61
|
+
var size = '/' + width + '-' + height + '/';
|
62
|
+
var link = dialog.getValueOf( 'info', 'txtUrl' );
|
63
|
+
if ( link.search( /\/[0-9]+-[0-9]+\// ) != -1 ) {
|
64
|
+
link = link.replace( /\/[0-9]+-[0-9]+\//, size );
|
65
|
+
} else {
|
66
|
+
var id_position = link.search( /\/[0-9]+\// );
|
67
|
+
var id = link.match( /\/[0-9]+\// );
|
68
|
+
var tail = link.substring( id_position + id[0].length );
|
69
|
+
var link = link.substring( 0, id_position ) + id + size.substring( 1 ) + tail;
|
70
|
+
};
|
71
|
+
};
|
72
|
+
if ( mode == 'onResetSize' ) {
|
73
|
+
var link = dialog.getValueOf( 'info', 'txtUrl' );
|
74
|
+
if ( link.search( /\/[0-9]+-[0-9]+/ ) != -1 ) {
|
75
|
+
link = link.replace( /\/[0-9]+-[0-9]+/, '' );
|
76
|
+
} else {
|
77
|
+
return false;
|
78
|
+
};
|
79
|
+
};
|
80
|
+
dialog.setValueOf( 'info', 'txtUrl', link );
|
81
|
+
};
|
82
|
+
|
83
|
+
var updatePreview = function( dialog )
|
84
|
+
{
|
85
|
+
//Don't load before onShow.
|
86
|
+
if ( !dialog.originalElement || !dialog.preview )
|
87
|
+
return 1;
|
88
|
+
|
89
|
+
// Read attributes and update imagePreview;
|
90
|
+
dialog.commitContent( PREVIEW, dialog.preview );
|
91
|
+
return 0;
|
92
|
+
};
|
93
|
+
|
94
|
+
// Custom commit dialog logic, where we're intended to give inline style
|
95
|
+
// field (txtdlgGenStyle) higher priority to avoid overwriting styles contribute
|
96
|
+
// by other fields.
|
97
|
+
function commitContent()
|
98
|
+
{
|
99
|
+
var args = arguments;
|
100
|
+
var inlineStyleField = this.getContentElement( 'advanced', 'txtdlgGenStyle' );
|
101
|
+
inlineStyleField && inlineStyleField.commit.apply( inlineStyleField, args );
|
102
|
+
|
103
|
+
this.foreach( function( widget )
|
104
|
+
{
|
105
|
+
if ( widget.commit && widget.id != 'txtdlgGenStyle' )
|
106
|
+
widget.commit.apply( widget, args );
|
107
|
+
});
|
108
|
+
}
|
109
|
+
|
110
|
+
// Avoid recursions.
|
111
|
+
var incommit;
|
112
|
+
|
113
|
+
// Synchronous field values to other impacted fields is required, e.g. border
|
114
|
+
// size change should alter inline-style text as well.
|
115
|
+
function commitInternally( targetFields )
|
116
|
+
{
|
117
|
+
if ( incommit )
|
118
|
+
return;
|
119
|
+
|
120
|
+
incommit = 1;
|
121
|
+
|
122
|
+
var dialog = this.getDialog(),
|
123
|
+
element = dialog.imageElement;
|
124
|
+
if ( element )
|
125
|
+
{
|
126
|
+
// Commit this field and broadcast to target fields.
|
127
|
+
this.commit( IMAGE, element );
|
128
|
+
|
129
|
+
targetFields = [].concat( targetFields );
|
130
|
+
var length = targetFields.length,
|
131
|
+
field;
|
132
|
+
for ( var i = 0; i < length; i++ )
|
133
|
+
{
|
134
|
+
field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) );
|
135
|
+
// May cause recursion.
|
136
|
+
field && field.setup( IMAGE, element );
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
incommit = 0;
|
141
|
+
}
|
142
|
+
|
143
|
+
var switchLockRatio = function( dialog, value )
|
144
|
+
{
|
145
|
+
if ( !dialog.getContentElement( 'info', 'ratioLock' ) )
|
146
|
+
return null;
|
147
|
+
|
148
|
+
var oImageOriginal = dialog.originalElement;
|
149
|
+
|
150
|
+
// Dialog may already closed. (#5505)
|
151
|
+
if( !oImageOriginal )
|
152
|
+
return null;
|
153
|
+
|
154
|
+
// Check image ratio and original image ratio, but respecting user's preference.
|
155
|
+
if ( value == 'check' )
|
156
|
+
{
|
157
|
+
if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true' )
|
158
|
+
{
|
159
|
+
var width = dialog.getValueOf( 'info', 'txtWidth' ),
|
160
|
+
height = dialog.getValueOf( 'info', 'txtHeight' ),
|
161
|
+
originalRatio = oImageOriginal.$.width * 1000 / oImageOriginal.$.height,
|
162
|
+
thisRatio = width * 1000 / height;
|
163
|
+
dialog.lockRatio = false; // Default: unlock ratio
|
164
|
+
|
165
|
+
if ( !width && !height )
|
166
|
+
dialog.lockRatio = true;
|
167
|
+
else if ( !isNaN( originalRatio ) && !isNaN( thisRatio ) )
|
168
|
+
{
|
169
|
+
if ( Math.round( originalRatio ) == Math.round( thisRatio ) )
|
170
|
+
dialog.lockRatio = true;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
else if ( value != undefined )
|
175
|
+
dialog.lockRatio = value;
|
176
|
+
else
|
177
|
+
{
|
178
|
+
dialog.userlockRatio = 1;
|
179
|
+
dialog.lockRatio = !dialog.lockRatio;
|
180
|
+
}
|
181
|
+
|
182
|
+
var ratioButton = CKEDITOR.document.getById( btnLockSizesId );
|
183
|
+
if ( dialog.lockRatio )
|
184
|
+
ratioButton.removeClass( 'cke_btn_unlocked' );
|
185
|
+
else
|
186
|
+
ratioButton.addClass( 'cke_btn_unlocked' );
|
187
|
+
|
188
|
+
ratioButton.setAttribute( 'aria-checked', dialog.lockRatio );
|
189
|
+
|
190
|
+
// Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE
|
191
|
+
if ( CKEDITOR.env.hc )
|
192
|
+
{
|
193
|
+
var icon = ratioButton.getChild( 0 );
|
194
|
+
icon.setHtml( dialog.lockRatio ? CKEDITOR.env.ie ? '\u25A0': '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' );
|
195
|
+
}
|
196
|
+
|
197
|
+
return dialog.lockRatio;
|
198
|
+
};
|
199
|
+
|
200
|
+
var resetSize = function( dialog )
|
201
|
+
{
|
202
|
+
changeImageUrl( dialog, 'onResetSize' );
|
203
|
+
var oImageOriginal = dialog.originalElement;
|
204
|
+
if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
|
205
|
+
{
|
206
|
+
var widthField = dialog.getContentElement( 'info', 'txtWidth' ),
|
207
|
+
heightField = dialog.getContentElement( 'info', 'txtHeight' );
|
208
|
+
widthField && widthField.setValue( oImageOriginal.$.width );
|
209
|
+
heightField && heightField.setValue( oImageOriginal.$.height );
|
210
|
+
}
|
211
|
+
updatePreview( dialog );
|
212
|
+
};
|
213
|
+
|
214
|
+
var setupDimension = function( type, element )
|
215
|
+
{
|
216
|
+
if ( type != IMAGE )
|
217
|
+
return;
|
218
|
+
|
219
|
+
function checkDimension( size, defaultValue )
|
220
|
+
{
|
221
|
+
var aMatch = size.match( regexGetSize );
|
222
|
+
if ( aMatch )
|
223
|
+
{
|
224
|
+
if ( aMatch[2] == '%' ) // % is allowed.
|
225
|
+
{
|
226
|
+
aMatch[1] += '%';
|
227
|
+
switchLockRatio( dialog, false ); // Unlock ratio
|
228
|
+
}
|
229
|
+
return aMatch[1];
|
230
|
+
}
|
231
|
+
return defaultValue;
|
232
|
+
}
|
233
|
+
|
234
|
+
var dialog = this.getDialog(),
|
235
|
+
value = '',
|
236
|
+
dimension = this.id == 'txtWidth' ? 'width' : 'height',
|
237
|
+
size = element.getAttribute( dimension );
|
238
|
+
|
239
|
+
if ( size )
|
240
|
+
value = checkDimension( size, value );
|
241
|
+
value = checkDimension( element.getStyle( dimension ), value );
|
242
|
+
|
243
|
+
this.setValue( value );
|
244
|
+
};
|
245
|
+
|
246
|
+
var previewPreloader;
|
247
|
+
|
248
|
+
var onImgLoadEvent = function()
|
249
|
+
{
|
250
|
+
// Image is ready.
|
251
|
+
var original = this.originalElement;
|
252
|
+
original.setCustomData( 'isReady', 'true' );
|
253
|
+
original.removeListener( 'load', onImgLoadEvent );
|
254
|
+
original.removeListener( 'error', onImgLoadErrorEvent );
|
255
|
+
original.removeListener( 'abort', onImgLoadErrorEvent );
|
256
|
+
|
257
|
+
// Hide loader
|
258
|
+
CKEDITOR.document.getById( imagePreviewLoaderId ).setStyle( 'display', 'none' );
|
259
|
+
|
260
|
+
// New image -> new domensions
|
261
|
+
if ( !this.dontResetSize )
|
262
|
+
resetSize( this );
|
263
|
+
|
264
|
+
if ( this.firstLoad )
|
265
|
+
CKEDITOR.tools.setTimeout( function(){ switchLockRatio( this, 'check' ); }, 0, this );
|
266
|
+
|
267
|
+
this.firstLoad = false;
|
268
|
+
this.dontResetSize = false;
|
269
|
+
};
|
270
|
+
|
271
|
+
var onImgLoadErrorEvent = function()
|
272
|
+
{
|
273
|
+
// Error. Image is not loaded.
|
274
|
+
var original = this.originalElement;
|
275
|
+
original.removeListener( 'load', onImgLoadEvent );
|
276
|
+
original.removeListener( 'error', onImgLoadErrorEvent );
|
277
|
+
original.removeListener( 'abort', onImgLoadErrorEvent );
|
278
|
+
|
279
|
+
// Set Error image.
|
280
|
+
var noimage = CKEDITOR.getUrl( editor.skinPath + 'images/noimage.png' );
|
281
|
+
|
282
|
+
if ( this.preview )
|
283
|
+
this.preview.setAttribute( 'src', noimage );
|
284
|
+
|
285
|
+
// Hide loader
|
286
|
+
CKEDITOR.document.getById( imagePreviewLoaderId ).setStyle( 'display', 'none' );
|
287
|
+
switchLockRatio( this, false ); // Unlock.
|
288
|
+
};
|
289
|
+
|
290
|
+
var numbering = function( id )
|
291
|
+
{
|
292
|
+
return CKEDITOR.tools.getNextId() + '_' + id;
|
293
|
+
},
|
294
|
+
btnLockSizesId = numbering( 'btnLockSizes' ),
|
295
|
+
btnResetSizeId = numbering( 'btnResetSize' ),
|
296
|
+
imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ),
|
297
|
+
imagePreviewBoxId = numbering( 'ImagePreviewBox' ),
|
298
|
+
previewLinkId = numbering( 'previewLink' ),
|
299
|
+
previewImageId = numbering( 'previewImage' );
|
300
|
+
|
301
|
+
return {
|
302
|
+
title : editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ],
|
303
|
+
minWidth : 420,
|
304
|
+
minHeight : 360,
|
305
|
+
onShow : function()
|
306
|
+
{
|
307
|
+
this.imageElement = false;
|
308
|
+
this.linkElement = false;
|
309
|
+
|
310
|
+
// Default: create a new element.
|
311
|
+
this.imageEditMode = false;
|
312
|
+
this.linkEditMode = false;
|
313
|
+
|
314
|
+
this.lockRatio = true;
|
315
|
+
this.userlockRatio = 0;
|
316
|
+
this.dontResetSize = false;
|
317
|
+
this.firstLoad = true;
|
318
|
+
this.addLink = false;
|
319
|
+
|
320
|
+
var editor = this.getParentEditor(),
|
321
|
+
sel = this.getParentEditor().getSelection(),
|
322
|
+
element = sel.getSelectedElement(),
|
323
|
+
link = element && element.getAscendant( 'a' );
|
324
|
+
|
325
|
+
//Hide loader.
|
326
|
+
CKEDITOR.document.getById( imagePreviewLoaderId ).setStyle( 'display', 'none' );
|
327
|
+
// Create the preview before setup the dialog contents.
|
328
|
+
previewPreloader = new CKEDITOR.dom.element( 'img', editor.document );
|
329
|
+
this.preview = CKEDITOR.document.getById( previewImageId );
|
330
|
+
|
331
|
+
// Copy of the image
|
332
|
+
this.originalElement = editor.document.createElement( 'img' );
|
333
|
+
this.originalElement.setAttribute( 'alt', '' );
|
334
|
+
this.originalElement.setCustomData( 'isReady', 'false' );
|
335
|
+
|
336
|
+
if ( link )
|
337
|
+
{
|
338
|
+
this.linkElement = link;
|
339
|
+
this.linkEditMode = true;
|
340
|
+
|
341
|
+
// Look for Image element.
|
342
|
+
var linkChildren = link.getChildren();
|
343
|
+
if ( linkChildren.count() == 1 ) // 1 child.
|
344
|
+
{
|
345
|
+
var childTagName = linkChildren.getItem( 0 ).getName();
|
346
|
+
if ( childTagName == 'img' || childTagName == 'input' )
|
347
|
+
{
|
348
|
+
this.imageElement = linkChildren.getItem( 0 );
|
349
|
+
if ( this.imageElement.getName() == 'img' )
|
350
|
+
this.imageEditMode = 'img';
|
351
|
+
else if ( this.imageElement.getName() == 'input' )
|
352
|
+
this.imageEditMode = 'input';
|
353
|
+
}
|
354
|
+
}
|
355
|
+
// Fill out all fields.
|
356
|
+
if ( dialogType == 'image' )
|
357
|
+
this.setupContent( LINK, link );
|
358
|
+
}
|
359
|
+
|
360
|
+
if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' )
|
361
|
+
|| element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' )
|
362
|
+
{
|
363
|
+
this.imageEditMode = element.getName();
|
364
|
+
this.imageElement = element;
|
365
|
+
}
|
366
|
+
|
367
|
+
if ( this.imageEditMode )
|
368
|
+
{
|
369
|
+
// Use the original element as a buffer from since we don't want
|
370
|
+
// temporary changes to be committed, e.g. if the dialog is canceled.
|
371
|
+
this.cleanImageElement = this.imageElement;
|
372
|
+
this.imageElement = this.cleanImageElement.clone( true, true );
|
373
|
+
|
374
|
+
// Fill out all fields.
|
375
|
+
this.setupContent( IMAGE, this.imageElement );
|
376
|
+
}
|
377
|
+
else
|
378
|
+
this.imageElement = editor.document.createElement( 'img' );
|
379
|
+
|
380
|
+
// Refresh LockRatio button
|
381
|
+
switchLockRatio ( this, true );
|
382
|
+
|
383
|
+
// Dont show preview if no URL given.
|
384
|
+
if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) )
|
385
|
+
{
|
386
|
+
this.preview.removeAttribute( 'src' );
|
387
|
+
this.preview.setStyle( 'display', 'none' );
|
388
|
+
}
|
389
|
+
},
|
390
|
+
onOk : function()
|
391
|
+
{
|
392
|
+
changeImageUrl( this, 'onOk' );
|
393
|
+
// Edit existing Image.
|
394
|
+
if ( this.imageEditMode )
|
395
|
+
{
|
396
|
+
var imgTagName = this.imageEditMode;
|
397
|
+
|
398
|
+
// Image dialog and Input element.
|
399
|
+
if ( dialogType == 'image' && imgTagName == 'input' && confirm( editor.lang.image.button2Img ) )
|
400
|
+
{
|
401
|
+
// Replace INPUT-> IMG
|
402
|
+
imgTagName = 'img';
|
403
|
+
this.imageElement = editor.document.createElement( 'img' );
|
404
|
+
this.imageElement.setAttribute( 'alt', '' );
|
405
|
+
editor.insertElement( this.imageElement );
|
406
|
+
}
|
407
|
+
// ImageButton dialog and Image element.
|
408
|
+
else if ( dialogType != 'image' && imgTagName == 'img' && confirm( editor.lang.image.img2Button ))
|
409
|
+
{
|
410
|
+
// Replace IMG -> INPUT
|
411
|
+
imgTagName = 'input';
|
412
|
+
this.imageElement = editor.document.createElement( 'input' );
|
413
|
+
this.imageElement.setAttributes(
|
414
|
+
{
|
415
|
+
type : 'image',
|
416
|
+
alt : ''
|
417
|
+
}
|
418
|
+
);
|
419
|
+
editor.insertElement( this.imageElement );
|
420
|
+
}
|
421
|
+
else
|
422
|
+
{
|
423
|
+
// Restore the original element before all commits.
|
424
|
+
this.imageElement = this.cleanImageElement;
|
425
|
+
delete this.cleanImageElement;
|
426
|
+
}
|
427
|
+
}
|
428
|
+
else // Create a new image.
|
429
|
+
{
|
430
|
+
// Image dialog -> create IMG element.
|
431
|
+
if ( dialogType == 'image' )
|
432
|
+
this.imageElement = editor.document.createElement( 'img' );
|
433
|
+
else
|
434
|
+
{
|
435
|
+
this.imageElement = editor.document.createElement( 'input' );
|
436
|
+
this.imageElement.setAttribute ( 'type' ,'image' );
|
437
|
+
}
|
438
|
+
this.imageElement.setAttribute( 'alt', '' );
|
439
|
+
}
|
440
|
+
|
441
|
+
// Create a new link.
|
442
|
+
if ( !this.linkEditMode )
|
443
|
+
this.linkElement = editor.document.createElement( 'a' );
|
444
|
+
|
445
|
+
// Set attributes.
|
446
|
+
this.commitContent( IMAGE, this.imageElement );
|
447
|
+
this.commitContent( LINK, this.linkElement );
|
448
|
+
|
449
|
+
// Remove empty style attribute.
|
450
|
+
if ( !this.imageElement.getAttribute( 'style' ) )
|
451
|
+
this.imageElement.removeAttribute( 'style' );
|
452
|
+
|
453
|
+
// Insert a new Image.
|
454
|
+
if ( !this.imageEditMode )
|
455
|
+
{
|
456
|
+
if ( this.addLink )
|
457
|
+
{
|
458
|
+
//Insert a new Link.
|
459
|
+
if ( !this.linkEditMode )
|
460
|
+
{
|
461
|
+
editor.insertElement( this.linkElement );
|
462
|
+
this.linkElement.append( this.imageElement, false );
|
463
|
+
}
|
464
|
+
else //Link already exists, image not.
|
465
|
+
editor.insertElement( this.imageElement );
|
466
|
+
}
|
467
|
+
else
|
468
|
+
editor.insertElement( this.imageElement );
|
469
|
+
}
|
470
|
+
else // Image already exists.
|
471
|
+
{
|
472
|
+
//Add a new link element.
|
473
|
+
if ( !this.linkEditMode && this.addLink )
|
474
|
+
{
|
475
|
+
editor.insertElement( this.linkElement );
|
476
|
+
this.imageElement.appendTo( this.linkElement );
|
477
|
+
}
|
478
|
+
//Remove Link, Image exists.
|
479
|
+
else if ( this.linkEditMode && !this.addLink )
|
480
|
+
{
|
481
|
+
editor.getSelection().selectElement( this.linkElement );
|
482
|
+
editor.insertElement( this.imageElement );
|
483
|
+
}
|
484
|
+
}
|
485
|
+
},
|
486
|
+
onLoad : function()
|
487
|
+
{
|
488
|
+
if ( dialogType != 'image' )
|
489
|
+
this.hidePage( 'Link' ); //Hide Link tab.
|
490
|
+
var doc = this._.element.getDocument();
|
491
|
+
|
492
|
+
if ( this.getContentElement( 'info', 'ratioLock' ) )
|
493
|
+
{
|
494
|
+
this.addFocusable( doc.getById( btnResetSizeId ), 5 );
|
495
|
+
this.addFocusable( doc.getById( btnLockSizesId ), 5 );
|
496
|
+
}
|
497
|
+
|
498
|
+
this.commitContent = commitContent;
|
499
|
+
},
|
500
|
+
onHide : function()
|
501
|
+
{
|
502
|
+
if ( this.preview )
|
503
|
+
this.commitContent( CLEANUP, this.preview );
|
504
|
+
|
505
|
+
if ( this.originalElement )
|
506
|
+
{
|
507
|
+
this.originalElement.removeListener( 'load', onImgLoadEvent );
|
508
|
+
this.originalElement.removeListener( 'error', onImgLoadErrorEvent );
|
509
|
+
this.originalElement.removeListener( 'abort', onImgLoadErrorEvent );
|
510
|
+
this.originalElement.remove();
|
511
|
+
this.originalElement = false; // Dialog is closed.
|
512
|
+
}
|
513
|
+
|
514
|
+
delete this.imageElement;
|
515
|
+
},
|
516
|
+
contents : [
|
517
|
+
{
|
518
|
+
id : 'info',
|
519
|
+
label : editor.lang.image.infoTab,
|
520
|
+
accessKey : 'I',
|
521
|
+
elements :
|
522
|
+
[
|
523
|
+
{
|
524
|
+
type : 'vbox',
|
525
|
+
padding : 0,
|
526
|
+
children :
|
527
|
+
[
|
528
|
+
{
|
529
|
+
type : 'hbox',
|
530
|
+
widths : [ '320px', '80px' ],
|
531
|
+
align : 'right',
|
532
|
+
children :
|
533
|
+
[
|
534
|
+
{
|
535
|
+
id : 'txtUrl',
|
536
|
+
type : 'text',
|
537
|
+
label : editor.lang.common.url,
|
538
|
+
required: true,
|
539
|
+
onLoad : function()
|
540
|
+
{
|
541
|
+
this.getInputElement().setAttribute( 'readonly', 'readonly' );
|
542
|
+
},
|
543
|
+
onChange : function()
|
544
|
+
{
|
545
|
+
var dialog = this.getDialog(),
|
546
|
+
newUrl = this.getValue();
|
547
|
+
|
548
|
+
//Update original image
|
549
|
+
if ( newUrl.length > 0 ) //Prevent from load before onShow
|
550
|
+
{
|
551
|
+
dialog = this.getDialog();
|
552
|
+
var original = dialog.originalElement;
|
553
|
+
|
554
|
+
dialog.preview.removeStyle( 'display' );
|
555
|
+
|
556
|
+
original.setCustomData( 'isReady', 'false' );
|
557
|
+
// Show loader
|
558
|
+
var loader = CKEDITOR.document.getById( imagePreviewLoaderId );
|
559
|
+
if ( loader )
|
560
|
+
loader.setStyle( 'display', '' );
|
561
|
+
|
562
|
+
original.on( 'load', onImgLoadEvent, dialog );
|
563
|
+
original.on( 'error', onImgLoadErrorEvent, dialog );
|
564
|
+
original.on( 'abort', onImgLoadErrorEvent, dialog );
|
565
|
+
original.setAttribute( 'src', newUrl );
|
566
|
+
|
567
|
+
// Query the preloader to figure out the url impacted by based href.
|
568
|
+
previewPreloader.setAttribute( 'src', newUrl );
|
569
|
+
dialog.preview.setAttribute( 'src', previewPreloader.$.src );
|
570
|
+
updatePreview( dialog );
|
571
|
+
}
|
572
|
+
// Dont show preview if no URL given.
|
573
|
+
else if ( dialog.preview )
|
574
|
+
{
|
575
|
+
dialog.preview.removeAttribute( 'src' );
|
576
|
+
dialog.preview.setStyle( 'display', 'none' );
|
577
|
+
}
|
578
|
+
},
|
579
|
+
setup : function( type, element )
|
580
|
+
{
|
581
|
+
if ( type == IMAGE )
|
582
|
+
{
|
583
|
+
var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' );
|
584
|
+
var field = this;
|
585
|
+
|
586
|
+
this.getDialog().dontResetSize = true;
|
587
|
+
|
588
|
+
field.setValue( url ); // And call this.onChange()
|
589
|
+
// Manually set the initial value.(#4191)
|
590
|
+
field.setInitValue();
|
591
|
+
}
|
592
|
+
},
|
593
|
+
commit : function( type, element )
|
594
|
+
{
|
595
|
+
if ( type == IMAGE && ( this.getValue() || this.isChanged() ) )
|
596
|
+
{
|
597
|
+
element.data( 'cke-saved-src', this.getValue() );
|
598
|
+
element.setAttribute( 'src', this.getValue() );
|
599
|
+
}
|
600
|
+
else if ( type == CLEANUP )
|
601
|
+
{
|
602
|
+
element.setAttribute( 'src', '' ); // If removeAttribute doesn't work.
|
603
|
+
element.removeAttribute( 'src' );
|
604
|
+
}
|
605
|
+
},
|
606
|
+
validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing )
|
607
|
+
},
|
608
|
+
{
|
609
|
+
type : 'button',
|
610
|
+
id : 'browse',
|
611
|
+
// v-align with the 'txtUrl' field.
|
612
|
+
// TODO: We need something better than a fixed size here.
|
613
|
+
style : 'display:inline-block;margin-top:10px;',
|
614
|
+
align : 'center',
|
615
|
+
label : editor.lang.esp_image.browseServer,
|
616
|
+
hidden : true,
|
617
|
+
filebrowser :
|
618
|
+
{
|
619
|
+
action : 'Browse',
|
620
|
+
target: 'info:txtUrl',
|
621
|
+
url: editor.config.filebrowserImageBrowseUrl
|
622
|
+
}
|
623
|
+
}
|
624
|
+
]
|
625
|
+
}
|
626
|
+
]
|
627
|
+
},
|
628
|
+
{
|
629
|
+
id : 'txtAlt',
|
630
|
+
type : 'text',
|
631
|
+
label : editor.lang.image.alt,
|
632
|
+
accessKey : 'T',
|
633
|
+
'default' : '',
|
634
|
+
onChange : function()
|
635
|
+
{
|
636
|
+
updatePreview( this.getDialog() );
|
637
|
+
},
|
638
|
+
setup : function( type, element )
|
639
|
+
{
|
640
|
+
if ( type == IMAGE )
|
641
|
+
this.setValue( element.getAttribute( 'alt' ) );
|
642
|
+
},
|
643
|
+
commit : function( type, element )
|
644
|
+
{
|
645
|
+
if ( type == IMAGE )
|
646
|
+
{
|
647
|
+
if ( this.getValue() || this.isChanged() )
|
648
|
+
element.setAttribute( 'alt', this.getValue() );
|
649
|
+
}
|
650
|
+
else if ( type == PREVIEW )
|
651
|
+
{
|
652
|
+
element.setAttribute( 'alt', this.getValue() );
|
653
|
+
}
|
654
|
+
else if ( type == CLEANUP )
|
655
|
+
{
|
656
|
+
element.removeAttribute( 'alt' );
|
657
|
+
}
|
658
|
+
}
|
659
|
+
},
|
660
|
+
{
|
661
|
+
type : 'hbox',
|
662
|
+
children :
|
663
|
+
[
|
664
|
+
{
|
665
|
+
id : 'basic',
|
666
|
+
type : 'vbox',
|
667
|
+
children :
|
668
|
+
[
|
669
|
+
{
|
670
|
+
type : 'hbox',
|
671
|
+
widths : [ '50%', '50%' ],
|
672
|
+
children :
|
673
|
+
[
|
674
|
+
{
|
675
|
+
type : 'vbox',
|
676
|
+
padding : 1,
|
677
|
+
children :
|
678
|
+
[
|
679
|
+
{
|
680
|
+
type : 'text',
|
681
|
+
width: '40px',
|
682
|
+
id : 'txtWidth',
|
683
|
+
label : editor.lang.common.width,
|
684
|
+
onKeyUp : onSizeChange,
|
685
|
+
onChange : function()
|
686
|
+
{
|
687
|
+
commitInternally.call( this, 'advanced:txtdlgGenStyle' );
|
688
|
+
},
|
689
|
+
validate : function()
|
690
|
+
{
|
691
|
+
var aMatch = this.getValue().match( regexGetSizeOrEmpty ),
|
692
|
+
isValid = !!( aMatch && parseInt( aMatch[1], 10 ) !== 0 );
|
693
|
+
if ( !isValid )
|
694
|
+
alert( editor.lang.common.invalidWidth );
|
695
|
+
return isValid;
|
696
|
+
},
|
697
|
+
setup : setupDimension,
|
698
|
+
commit : function( type, element, internalCommit )
|
699
|
+
{
|
700
|
+
var value = this.getValue();
|
701
|
+
if ( type == IMAGE )
|
702
|
+
{
|
703
|
+
if ( value )
|
704
|
+
element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) );
|
705
|
+
else
|
706
|
+
element.removeStyle( 'width' );
|
707
|
+
|
708
|
+
!internalCommit && element.removeAttribute( 'width' );
|
709
|
+
}
|
710
|
+
else if ( type == PREVIEW )
|
711
|
+
{
|
712
|
+
var aMatch = value.match( regexGetSize );
|
713
|
+
if ( !aMatch )
|
714
|
+
{
|
715
|
+
var oImageOriginal = this.getDialog().originalElement;
|
716
|
+
if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
|
717
|
+
element.setStyle( 'width', oImageOriginal.$.width + 'px');
|
718
|
+
}
|
719
|
+
else
|
720
|
+
element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) );
|
721
|
+
}
|
722
|
+
else if ( type == CLEANUP )
|
723
|
+
{
|
724
|
+
element.removeAttribute( 'width' );
|
725
|
+
element.removeStyle( 'width' );
|
726
|
+
}
|
727
|
+
}
|
728
|
+
},
|
729
|
+
{
|
730
|
+
type : 'text',
|
731
|
+
id : 'txtHeight',
|
732
|
+
width: '40px',
|
733
|
+
label : editor.lang.common.height,
|
734
|
+
onKeyUp : onSizeChange,
|
735
|
+
onChange : function()
|
736
|
+
{
|
737
|
+
commitInternally.call( this, 'advanced:txtdlgGenStyle' );
|
738
|
+
},
|
739
|
+
validate : function()
|
740
|
+
{
|
741
|
+
var aMatch = this.getValue().match( regexGetSizeOrEmpty ),
|
742
|
+
isValid = !!( aMatch && parseInt( aMatch[1], 10 ) !== 0 );
|
743
|
+
if ( !isValid )
|
744
|
+
alert( editor.lang.common.invalidHeight );
|
745
|
+
return isValid;
|
746
|
+
},
|
747
|
+
setup : setupDimension,
|
748
|
+
commit : function( type, element, internalCommit )
|
749
|
+
{
|
750
|
+
var value = this.getValue();
|
751
|
+
if ( type == IMAGE )
|
752
|
+
{
|
753
|
+
if ( value )
|
754
|
+
element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) );
|
755
|
+
else
|
756
|
+
element.removeStyle( 'height' );
|
757
|
+
|
758
|
+
!internalCommit && element.removeAttribute( 'height' );
|
759
|
+
}
|
760
|
+
else if ( type == PREVIEW )
|
761
|
+
{
|
762
|
+
var aMatch = value.match( regexGetSize );
|
763
|
+
if ( !aMatch )
|
764
|
+
{
|
765
|
+
var oImageOriginal = this.getDialog().originalElement;
|
766
|
+
if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
|
767
|
+
element.setStyle( 'height', oImageOriginal.$.height + 'px' );
|
768
|
+
}
|
769
|
+
else
|
770
|
+
element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) );
|
771
|
+
}
|
772
|
+
else if ( type == CLEANUP )
|
773
|
+
{
|
774
|
+
element.removeAttribute( 'height' );
|
775
|
+
element.removeStyle( 'height' );
|
776
|
+
}
|
777
|
+
}
|
778
|
+
}
|
779
|
+
]
|
780
|
+
},
|
781
|
+
{
|
782
|
+
id : 'ratioLock',
|
783
|
+
type : 'html',
|
784
|
+
style : 'margin-top:30px;width:40px;height:40px;',
|
785
|
+
onLoad : function()
|
786
|
+
{
|
787
|
+
// Activate Reset button
|
788
|
+
var resetButton = CKEDITOR.document.getById( btnResetSizeId ),
|
789
|
+
ratioButton = CKEDITOR.document.getById( btnLockSizesId );
|
790
|
+
if ( resetButton )
|
791
|
+
{
|
792
|
+
resetButton.on( 'click', function( evt )
|
793
|
+
{
|
794
|
+
resetSize( this );
|
795
|
+
evt.data && evt.data.preventDefault();
|
796
|
+
}, this.getDialog() );
|
797
|
+
resetButton.on( 'mouseover', function()
|
798
|
+
{
|
799
|
+
this.addClass( 'cke_btn_over' );
|
800
|
+
}, resetButton );
|
801
|
+
resetButton.on( 'mouseout', function()
|
802
|
+
{
|
803
|
+
this.removeClass( 'cke_btn_over' );
|
804
|
+
}, resetButton );
|
805
|
+
}
|
806
|
+
// Activate (Un)LockRatio button
|
807
|
+
if ( ratioButton )
|
808
|
+
{
|
809
|
+
ratioButton.on( 'click', function(evt)
|
810
|
+
{
|
811
|
+
var locked = switchLockRatio( this ),
|
812
|
+
oImageOriginal = this.originalElement,
|
813
|
+
width = this.getValueOf( 'info', 'txtWidth' );
|
814
|
+
|
815
|
+
if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' && width )
|
816
|
+
{
|
817
|
+
var height = oImageOriginal.$.height / oImageOriginal.$.width * width;
|
818
|
+
if ( !isNaN( height ) )
|
819
|
+
{
|
820
|
+
this.setValueOf( 'info', 'txtHeight', Math.round( height ) );
|
821
|
+
updatePreview( this );
|
822
|
+
}
|
823
|
+
}
|
824
|
+
evt.data && evt.data.preventDefault();
|
825
|
+
}, this.getDialog() );
|
826
|
+
ratioButton.on( 'mouseover', function()
|
827
|
+
{
|
828
|
+
this.addClass( 'cke_btn_over' );
|
829
|
+
}, ratioButton );
|
830
|
+
ratioButton.on( 'mouseout', function()
|
831
|
+
{
|
832
|
+
this.removeClass( 'cke_btn_over' );
|
833
|
+
}, ratioButton );
|
834
|
+
}
|
835
|
+
},
|
836
|
+
html : '<div>'+
|
837
|
+
'<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.lockRatio +
|
838
|
+
'" class="cke_btn_locked" id="' + btnLockSizesId + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + editor.lang.image.lockRatio + '</span></a>' +
|
839
|
+
'<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.resetSize +
|
840
|
+
'" class="cke_btn_reset" id="' + btnResetSizeId + '" role="button"><span class="cke_label">' + editor.lang.image.resetSize + '</span></a>'+
|
841
|
+
'</div>'
|
842
|
+
}
|
843
|
+
]
|
844
|
+
},
|
845
|
+
{
|
846
|
+
type : 'vbox',
|
847
|
+
padding : 1,
|
848
|
+
children :
|
849
|
+
[
|
850
|
+
{
|
851
|
+
type : 'text',
|
852
|
+
id : 'txtBorder',
|
853
|
+
width: '60px',
|
854
|
+
label : editor.lang.image.border,
|
855
|
+
'default' : '',
|
856
|
+
onKeyUp : function()
|
857
|
+
{
|
858
|
+
updatePreview( this.getDialog() );
|
859
|
+
},
|
860
|
+
onChange : function()
|
861
|
+
{
|
862
|
+
commitInternally.call( this, 'advanced:txtdlgGenStyle' );
|
863
|
+
},
|
864
|
+
validate : CKEDITOR.dialog.validate.integer( editor.lang.image.validateBorder ),
|
865
|
+
setup : function( type, element )
|
866
|
+
{
|
867
|
+
if ( type == IMAGE )
|
868
|
+
{
|
869
|
+
var value,
|
870
|
+
borderStyle = element.getStyle( 'border-width' );
|
871
|
+
borderStyle = borderStyle && borderStyle.match( /^(\d+px)(?: \1 \1 \1)?$/ );
|
872
|
+
value = borderStyle && parseInt( borderStyle[ 1 ], 10 );
|
873
|
+
isNaN ( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'border' ) );
|
874
|
+
this.setValue( value );
|
875
|
+
}
|
876
|
+
},
|
877
|
+
commit : function( type, element, internalCommit )
|
878
|
+
{
|
879
|
+
var value = parseInt( this.getValue(), 10 );
|
880
|
+
if ( type == IMAGE || type == PREVIEW )
|
881
|
+
{
|
882
|
+
if ( !isNaN( value ) )
|
883
|
+
{
|
884
|
+
element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) );
|
885
|
+
element.setStyle( 'border-style', 'solid' );
|
886
|
+
}
|
887
|
+
else if ( !value && this.isChanged() )
|
888
|
+
{
|
889
|
+
element.removeStyle( 'border-width' );
|
890
|
+
element.removeStyle( 'border-style' );
|
891
|
+
element.removeStyle( 'border-color' );
|
892
|
+
}
|
893
|
+
|
894
|
+
if ( !internalCommit && type == IMAGE )
|
895
|
+
element.removeAttribute( 'border' );
|
896
|
+
}
|
897
|
+
else if ( type == CLEANUP )
|
898
|
+
{
|
899
|
+
element.removeAttribute( 'border' );
|
900
|
+
element.removeStyle( 'border-width' );
|
901
|
+
element.removeStyle( 'border-style' );
|
902
|
+
element.removeStyle( 'border-color' );
|
903
|
+
}
|
904
|
+
}
|
905
|
+
},
|
906
|
+
{
|
907
|
+
type : 'text',
|
908
|
+
id : 'txtHSpace',
|
909
|
+
width: '60px',
|
910
|
+
label : editor.lang.image.hSpace,
|
911
|
+
'default' : '',
|
912
|
+
onKeyUp : function()
|
913
|
+
{
|
914
|
+
updatePreview( this.getDialog() );
|
915
|
+
},
|
916
|
+
onChange : function()
|
917
|
+
{
|
918
|
+
commitInternally.call( this, 'advanced:txtdlgGenStyle' );
|
919
|
+
},
|
920
|
+
validate : CKEDITOR.dialog.validate.integer( editor.lang.image.validateHSpace ),
|
921
|
+
setup : function( type, element )
|
922
|
+
{
|
923
|
+
if ( type == IMAGE )
|
924
|
+
{
|
925
|
+
var value,
|
926
|
+
marginLeftPx,
|
927
|
+
marginRightPx,
|
928
|
+
marginLeftStyle = element.getStyle( 'margin-left' ),
|
929
|
+
marginRightStyle = element.getStyle( 'margin-right' );
|
930
|
+
|
931
|
+
marginLeftStyle = marginLeftStyle && marginLeftStyle.match( pxLengthRegex );
|
932
|
+
marginRightStyle = marginRightStyle && marginRightStyle.match( pxLengthRegex );
|
933
|
+
marginLeftPx = parseInt( marginLeftStyle, 10 );
|
934
|
+
marginRightPx = parseInt( marginRightStyle, 10 );
|
935
|
+
|
936
|
+
value = ( marginLeftPx == marginRightPx ) && marginLeftPx;
|
937
|
+
isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'hspace' ) );
|
938
|
+
|
939
|
+
this.setValue( value );
|
940
|
+
}
|
941
|
+
},
|
942
|
+
commit : function( type, element, internalCommit )
|
943
|
+
{
|
944
|
+
var value = parseInt( this.getValue(), 10 );
|
945
|
+
if ( type == IMAGE || type == PREVIEW )
|
946
|
+
{
|
947
|
+
if ( !isNaN( value ) )
|
948
|
+
{
|
949
|
+
element.setStyle( 'margin-left', CKEDITOR.tools.cssLength( value ) );
|
950
|
+
element.setStyle( 'margin-right', CKEDITOR.tools.cssLength( value ) );
|
951
|
+
}
|
952
|
+
else if ( !value && this.isChanged( ) )
|
953
|
+
{
|
954
|
+
element.removeStyle( 'margin-left' );
|
955
|
+
element.removeStyle( 'margin-right' );
|
956
|
+
}
|
957
|
+
|
958
|
+
if ( !internalCommit && type == IMAGE )
|
959
|
+
element.removeAttribute( 'hspace' );
|
960
|
+
}
|
961
|
+
else if ( type == CLEANUP )
|
962
|
+
{
|
963
|
+
element.removeAttribute( 'hspace' );
|
964
|
+
element.removeStyle( 'margin-left' );
|
965
|
+
element.removeStyle( 'margin-right' );
|
966
|
+
}
|
967
|
+
}
|
968
|
+
},
|
969
|
+
{
|
970
|
+
type : 'text',
|
971
|
+
id : 'txtVSpace',
|
972
|
+
width : '60px',
|
973
|
+
label : editor.lang.image.vSpace,
|
974
|
+
'default' : '',
|
975
|
+
onKeyUp : function()
|
976
|
+
{
|
977
|
+
updatePreview( this.getDialog() );
|
978
|
+
},
|
979
|
+
onChange : function()
|
980
|
+
{
|
981
|
+
commitInternally.call( this, 'advanced:txtdlgGenStyle' );
|
982
|
+
},
|
983
|
+
validate : CKEDITOR.dialog.validate.integer( editor.lang.image.validateVSpace ),
|
984
|
+
setup : function( type, element )
|
985
|
+
{
|
986
|
+
if ( type == IMAGE )
|
987
|
+
{
|
988
|
+
var value,
|
989
|
+
marginTopPx,
|
990
|
+
marginBottomPx,
|
991
|
+
marginTopStyle = element.getStyle( 'margin-top' ),
|
992
|
+
marginBottomStyle = element.getStyle( 'margin-bottom' );
|
993
|
+
|
994
|
+
marginTopStyle = marginTopStyle && marginTopStyle.match( pxLengthRegex );
|
995
|
+
marginBottomStyle = marginBottomStyle && marginBottomStyle.match( pxLengthRegex );
|
996
|
+
marginTopPx = parseInt( marginTopStyle, 10 );
|
997
|
+
marginBottomPx = parseInt( marginBottomStyle, 10 );
|
998
|
+
|
999
|
+
value = ( marginTopPx == marginBottomPx ) && marginTopPx;
|
1000
|
+
isNaN ( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'vspace' ) );
|
1001
|
+
this.setValue( value );
|
1002
|
+
}
|
1003
|
+
},
|
1004
|
+
commit : function( type, element, internalCommit )
|
1005
|
+
{
|
1006
|
+
var value = parseInt( this.getValue(), 10 );
|
1007
|
+
if ( type == IMAGE || type == PREVIEW )
|
1008
|
+
{
|
1009
|
+
if ( !isNaN( value ) )
|
1010
|
+
{
|
1011
|
+
element.setStyle( 'margin-top', CKEDITOR.tools.cssLength( value ) );
|
1012
|
+
element.setStyle( 'margin-bottom', CKEDITOR.tools.cssLength( value ) );
|
1013
|
+
}
|
1014
|
+
else if ( !value && this.isChanged( ) )
|
1015
|
+
{
|
1016
|
+
element.removeStyle( 'margin-top' );
|
1017
|
+
element.removeStyle( 'margin-bottom' );
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
if ( !internalCommit && type == IMAGE )
|
1021
|
+
element.removeAttribute( 'vspace' );
|
1022
|
+
}
|
1023
|
+
else if ( type == CLEANUP )
|
1024
|
+
{
|
1025
|
+
element.removeAttribute( 'vspace' );
|
1026
|
+
element.removeStyle( 'margin-top' );
|
1027
|
+
element.removeStyle( 'margin-bottom' );
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
},
|
1031
|
+
{
|
1032
|
+
id : 'cmbAlign',
|
1033
|
+
type : 'select',
|
1034
|
+
widths : [ '35%','65%' ],
|
1035
|
+
style : 'width:90px',
|
1036
|
+
label : editor.lang.common.align,
|
1037
|
+
'default' : '',
|
1038
|
+
items :
|
1039
|
+
[
|
1040
|
+
[ editor.lang.common.notSet , ''],
|
1041
|
+
[ editor.lang.common.alignLeft , 'left'],
|
1042
|
+
[ editor.lang.common.alignRight , 'right']
|
1043
|
+
],
|
1044
|
+
onChange : function()
|
1045
|
+
{
|
1046
|
+
updatePreview( this.getDialog() );
|
1047
|
+
commitInternally.call( this, 'advanced:txtdlgGenStyle' );
|
1048
|
+
},
|
1049
|
+
setup : function( type, element )
|
1050
|
+
{
|
1051
|
+
if ( type == IMAGE )
|
1052
|
+
{
|
1053
|
+
var value = element.getStyle( 'float' );
|
1054
|
+
switch( value )
|
1055
|
+
{
|
1056
|
+
// Ignore those unrelated values.
|
1057
|
+
case 'inherit':
|
1058
|
+
case 'none':
|
1059
|
+
value = '';
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
!value && ( value = ( element.getAttribute( 'align' ) || '' ).toLowerCase() );
|
1063
|
+
this.setValue( value );
|
1064
|
+
}
|
1065
|
+
},
|
1066
|
+
commit : function( type, element, internalCommit )
|
1067
|
+
{
|
1068
|
+
var value = this.getValue();
|
1069
|
+
if ( type == IMAGE || type == PREVIEW )
|
1070
|
+
{
|
1071
|
+
if ( value )
|
1072
|
+
element.setStyle( 'float', value );
|
1073
|
+
else
|
1074
|
+
element.removeStyle( 'float' );
|
1075
|
+
|
1076
|
+
if ( !internalCommit && type == IMAGE )
|
1077
|
+
{
|
1078
|
+
value = ( element.getAttribute( 'align' ) || '' ).toLowerCase();
|
1079
|
+
switch( value )
|
1080
|
+
{
|
1081
|
+
// we should remove it only if it matches "left" or "right",
|
1082
|
+
// otherwise leave it intact.
|
1083
|
+
case 'left':
|
1084
|
+
case 'right':
|
1085
|
+
element.removeAttribute( 'align' );
|
1086
|
+
}
|
1087
|
+
}
|
1088
|
+
}
|
1089
|
+
else if ( type == CLEANUP )
|
1090
|
+
element.removeStyle( 'float' );
|
1091
|
+
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
]
|
1095
|
+
}
|
1096
|
+
]
|
1097
|
+
},
|
1098
|
+
{
|
1099
|
+
type : 'vbox',
|
1100
|
+
height : '250px',
|
1101
|
+
children :
|
1102
|
+
[
|
1103
|
+
{
|
1104
|
+
type : 'html',
|
1105
|
+
id : 'htmlPreview',
|
1106
|
+
style : 'width:95%;',
|
1107
|
+
html : '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) +'<br>'+
|
1108
|
+
'<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div>'+
|
1109
|
+
'<div id="' + imagePreviewBoxId + '" class="ImagePreviewBox"><table><tr><td>'+
|
1110
|
+
'<a href="javascript:void(0)" target="_blank" onclick="return false;" id="' + previewLinkId + '">'+
|
1111
|
+
'<img id="' + previewImageId + '" alt="" /></a>' +
|
1112
|
+
( editor.config.image_previewText ||
|
1113
|
+
'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. '+
|
1114
|
+
'Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, '+
|
1115
|
+
'nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.' ) +
|
1116
|
+
'</td></tr></table></div></div>'
|
1117
|
+
}
|
1118
|
+
]
|
1119
|
+
}
|
1120
|
+
]
|
1121
|
+
}
|
1122
|
+
]
|
1123
|
+
},
|
1124
|
+
{
|
1125
|
+
id : 'Link',
|
1126
|
+
label : editor.lang.link.title,
|
1127
|
+
padding : 0,
|
1128
|
+
elements :
|
1129
|
+
[
|
1130
|
+
{
|
1131
|
+
id : 'txtUrl',
|
1132
|
+
type : 'text',
|
1133
|
+
label : editor.lang.common.url,
|
1134
|
+
style : 'width: 100%',
|
1135
|
+
'default' : '',
|
1136
|
+
setup : function( type, element )
|
1137
|
+
{
|
1138
|
+
if ( type == LINK )
|
1139
|
+
{
|
1140
|
+
var href = element.data( 'cke-saved-href' );
|
1141
|
+
if ( !href )
|
1142
|
+
href = element.getAttribute( 'href' );
|
1143
|
+
this.setValue( href );
|
1144
|
+
}
|
1145
|
+
},
|
1146
|
+
commit : function( type, element )
|
1147
|
+
{
|
1148
|
+
if ( type == LINK )
|
1149
|
+
{
|
1150
|
+
if ( this.getValue() || this.isChanged() )
|
1151
|
+
{
|
1152
|
+
var url = decodeURI( this.getValue() );
|
1153
|
+
element.data( 'cke-saved-href', url );
|
1154
|
+
element.setAttribute( 'href', url );
|
1155
|
+
|
1156
|
+
if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL )
|
1157
|
+
this.getDialog().addLink = true;
|
1158
|
+
}
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
},
|
1162
|
+
{
|
1163
|
+
type : 'button',
|
1164
|
+
id : 'browse',
|
1165
|
+
filebrowser :
|
1166
|
+
{
|
1167
|
+
action : 'Browse',
|
1168
|
+
target: 'Link:txtUrl',
|
1169
|
+
url: editor.config.filebrowserImageBrowseUrl
|
1170
|
+
},
|
1171
|
+
style : 'float:right',
|
1172
|
+
hidden : true,
|
1173
|
+
label : editor.lang.esp_image.browseServer
|
1174
|
+
},
|
1175
|
+
{
|
1176
|
+
id : 'cmbTarget',
|
1177
|
+
type : 'select',
|
1178
|
+
label : editor.lang.common.target,
|
1179
|
+
'default' : '',
|
1180
|
+
items :
|
1181
|
+
[
|
1182
|
+
[ editor.lang.common.notSet , ''],
|
1183
|
+
[ editor.lang.common.targetNew , '_blank'],
|
1184
|
+
[ editor.lang.common.targetTop , '_top'],
|
1185
|
+
[ editor.lang.common.targetSelf , '_self'],
|
1186
|
+
[ editor.lang.common.targetParent , '_parent']
|
1187
|
+
],
|
1188
|
+
setup : function( type, element )
|
1189
|
+
{
|
1190
|
+
if ( type == LINK )
|
1191
|
+
this.setValue( element.getAttribute( 'target' ) || '' );
|
1192
|
+
},
|
1193
|
+
commit : function( type, element )
|
1194
|
+
{
|
1195
|
+
if ( type == LINK )
|
1196
|
+
{
|
1197
|
+
if ( this.getValue() || this.isChanged() )
|
1198
|
+
element.setAttribute( 'target', this.getValue() );
|
1199
|
+
}
|
1200
|
+
}
|
1201
|
+
}
|
1202
|
+
]
|
1203
|
+
},
|
1204
|
+
{
|
1205
|
+
id : 'advanced',
|
1206
|
+
label : editor.lang.common.advancedTab,
|
1207
|
+
elements :
|
1208
|
+
[
|
1209
|
+
{
|
1210
|
+
type : 'hbox',
|
1211
|
+
widths : [ '50%', '25%', '25%' ],
|
1212
|
+
children :
|
1213
|
+
[
|
1214
|
+
{
|
1215
|
+
type : 'text',
|
1216
|
+
id : 'linkId',
|
1217
|
+
label : editor.lang.common.id,
|
1218
|
+
setup : function( type, element )
|
1219
|
+
{
|
1220
|
+
if ( type == IMAGE )
|
1221
|
+
this.setValue( element.getAttribute( 'id' ) );
|
1222
|
+
},
|
1223
|
+
commit : function( type, element )
|
1224
|
+
{
|
1225
|
+
if ( type == IMAGE )
|
1226
|
+
{
|
1227
|
+
if ( this.getValue() || this.isChanged() )
|
1228
|
+
element.setAttribute( 'id', this.getValue() );
|
1229
|
+
}
|
1230
|
+
}
|
1231
|
+
},
|
1232
|
+
{
|
1233
|
+
id : 'cmbLangDir',
|
1234
|
+
type : 'select',
|
1235
|
+
style : 'width : 100px;',
|
1236
|
+
label : editor.lang.common.langDir,
|
1237
|
+
'default' : '',
|
1238
|
+
items :
|
1239
|
+
[
|
1240
|
+
[ editor.lang.common.notSet, '' ],
|
1241
|
+
[ editor.lang.common.langDirLtr, 'ltr' ],
|
1242
|
+
[ editor.lang.common.langDirRtl, 'rtl' ]
|
1243
|
+
],
|
1244
|
+
setup : function( type, element )
|
1245
|
+
{
|
1246
|
+
if ( type == IMAGE )
|
1247
|
+
this.setValue( element.getAttribute( 'dir' ) );
|
1248
|
+
},
|
1249
|
+
commit : function( type, element )
|
1250
|
+
{
|
1251
|
+
if ( type == IMAGE )
|
1252
|
+
{
|
1253
|
+
if ( this.getValue() || this.isChanged() )
|
1254
|
+
element.setAttribute( 'dir', this.getValue() );
|
1255
|
+
}
|
1256
|
+
}
|
1257
|
+
},
|
1258
|
+
{
|
1259
|
+
type : 'text',
|
1260
|
+
id : 'txtLangCode',
|
1261
|
+
label : editor.lang.common.langCode,
|
1262
|
+
'default' : '',
|
1263
|
+
setup : function( type, element )
|
1264
|
+
{
|
1265
|
+
if ( type == IMAGE )
|
1266
|
+
this.setValue( element.getAttribute( 'lang' ) );
|
1267
|
+
},
|
1268
|
+
commit : function( type, element )
|
1269
|
+
{
|
1270
|
+
if ( type == IMAGE )
|
1271
|
+
{
|
1272
|
+
if ( this.getValue() || this.isChanged() )
|
1273
|
+
element.setAttribute( 'lang', this.getValue() );
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
}
|
1277
|
+
]
|
1278
|
+
},
|
1279
|
+
{
|
1280
|
+
type : 'text',
|
1281
|
+
id : 'txtGenLongDescr',
|
1282
|
+
label : editor.lang.common.longDescr,
|
1283
|
+
setup : function( type, element )
|
1284
|
+
{
|
1285
|
+
if ( type == IMAGE )
|
1286
|
+
this.setValue( element.getAttribute( 'longDesc' ) );
|
1287
|
+
},
|
1288
|
+
commit : function( type, element )
|
1289
|
+
{
|
1290
|
+
if ( type == IMAGE )
|
1291
|
+
{
|
1292
|
+
if ( this.getValue() || this.isChanged() )
|
1293
|
+
element.setAttribute( 'longDesc', this.getValue() );
|
1294
|
+
}
|
1295
|
+
}
|
1296
|
+
},
|
1297
|
+
{
|
1298
|
+
type : 'hbox',
|
1299
|
+
widths : [ '50%', '50%' ],
|
1300
|
+
children :
|
1301
|
+
[
|
1302
|
+
{
|
1303
|
+
type : 'text',
|
1304
|
+
id : 'txtGenClass',
|
1305
|
+
label : editor.lang.common.cssClass,
|
1306
|
+
'default' : '',
|
1307
|
+
setup : function( type, element )
|
1308
|
+
{
|
1309
|
+
if ( type == IMAGE )
|
1310
|
+
this.setValue( element.getAttribute( 'class' ) );
|
1311
|
+
},
|
1312
|
+
commit : function( type, element )
|
1313
|
+
{
|
1314
|
+
if ( type == IMAGE )
|
1315
|
+
{
|
1316
|
+
if ( this.getValue() || this.isChanged() )
|
1317
|
+
element.setAttribute( 'class', this.getValue() );
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
},
|
1321
|
+
{
|
1322
|
+
type : 'text',
|
1323
|
+
id : 'txtGenTitle',
|
1324
|
+
label : editor.lang.common.advisoryTitle,
|
1325
|
+
'default' : '',
|
1326
|
+
onChange : function()
|
1327
|
+
{
|
1328
|
+
updatePreview( this.getDialog() );
|
1329
|
+
},
|
1330
|
+
setup : function( type, element )
|
1331
|
+
{
|
1332
|
+
if ( type == IMAGE )
|
1333
|
+
this.setValue( element.getAttribute( 'title' ) );
|
1334
|
+
},
|
1335
|
+
commit : function( type, element )
|
1336
|
+
{
|
1337
|
+
if ( type == IMAGE )
|
1338
|
+
{
|
1339
|
+
if ( this.getValue() || this.isChanged() )
|
1340
|
+
element.setAttribute( 'title', this.getValue() );
|
1341
|
+
}
|
1342
|
+
else if ( type == PREVIEW )
|
1343
|
+
{
|
1344
|
+
element.setAttribute( 'title', this.getValue() );
|
1345
|
+
}
|
1346
|
+
else if ( type == CLEANUP )
|
1347
|
+
{
|
1348
|
+
element.removeAttribute( 'title' );
|
1349
|
+
}
|
1350
|
+
}
|
1351
|
+
}
|
1352
|
+
]
|
1353
|
+
},
|
1354
|
+
{
|
1355
|
+
type : 'text',
|
1356
|
+
id : 'txtdlgGenStyle',
|
1357
|
+
label : editor.lang.common.cssStyle,
|
1358
|
+
validate : CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),
|
1359
|
+
'default' : '',
|
1360
|
+
setup : function( type, element )
|
1361
|
+
{
|
1362
|
+
if ( type == IMAGE )
|
1363
|
+
{
|
1364
|
+
var genStyle = element.getAttribute( 'style' );
|
1365
|
+
if ( !genStyle && element.$.style.cssText )
|
1366
|
+
genStyle = element.$.style.cssText;
|
1367
|
+
this.setValue( genStyle );
|
1368
|
+
|
1369
|
+
var height = element.$.style.height,
|
1370
|
+
width = element.$.style.width,
|
1371
|
+
aMatchH = ( height ? height : '' ).match( regexGetSize ),
|
1372
|
+
aMatchW = ( width ? width : '').match( regexGetSize );
|
1373
|
+
|
1374
|
+
this.attributesInStyle =
|
1375
|
+
{
|
1376
|
+
height : !!aMatchH,
|
1377
|
+
width : !!aMatchW
|
1378
|
+
};
|
1379
|
+
}
|
1380
|
+
},
|
1381
|
+
onChange : function ()
|
1382
|
+
{
|
1383
|
+
commitInternally.call( this,
|
1384
|
+
[ 'info:cmbFloat', 'info:cmbAlign',
|
1385
|
+
'info:txtVSpace', 'info:txtHSpace',
|
1386
|
+
'info:txtBorder',
|
1387
|
+
'info:txtWidth', 'info:txtHeight' ] );
|
1388
|
+
updatePreview( this );
|
1389
|
+
},
|
1390
|
+
commit : function( type, element )
|
1391
|
+
{
|
1392
|
+
if ( type == IMAGE && ( this.getValue() || this.isChanged() ) )
|
1393
|
+
{
|
1394
|
+
element.setAttribute( 'style', this.getValue() );
|
1395
|
+
}
|
1396
|
+
}
|
1397
|
+
}
|
1398
|
+
]
|
1399
|
+
}
|
1400
|
+
]
|
1401
|
+
};
|
1402
|
+
};
|
1403
|
+
|
1404
|
+
CKEDITOR.dialog.add( 'esp_image', function( editor )
|
1405
|
+
{
|
1406
|
+
return esp_imageDialog( editor, 'image' );
|
1407
|
+
});
|
1408
|
+
|
1409
|
+
CKEDITOR.dialog.add( 'esp_imagebutton', function( editor )
|
1410
|
+
{
|
1411
|
+
return esp_imageDialog( editor, 'imagebutton' );
|
1412
|
+
});
|
1413
|
+
})();
|
1414
|
+
|