ckeditor-jess 3.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +161 -0
- data/Rakefile +45 -0
- data/app/controllers/ckeditor_controller.rb +85 -0
- data/app/helpers/ckeditor_helper.rb +38 -0
- data/app/views/ckeditor/_asset.html.erb +15 -0
- data/app/views/ckeditor/_swfupload.html.erb +51 -0
- data/app/views/ckeditor/files.html.erb +91 -0
- data/app/views/ckeditor/images.html.erb +91 -0
- data/app/views/layouts/ckeditor.html.erb +29 -0
- data/config/routes.rb +5 -0
- data/examples/migrations/attachment_fu/create_assets.rb +30 -0
- data/examples/migrations/paperclip/create_assets.rb +25 -0
- data/examples/models/attachment_fu/asset.rb +45 -0
- data/examples/models/attachment_fu/attachment_file.rb +46 -0
- data/examples/models/attachment_fu/picture.rb +46 -0
- data/examples/models/paperclip/asset.rb +65 -0
- data/examples/models/paperclip/attachment_file.rb +22 -0
- data/examples/models/paperclip/picture.rb +39 -0
- data/examples/s3/attachment_file.rb +23 -0
- data/examples/s3/picture.rb +41 -0
- data/examples/s3/s3.yml +2 -0
- data/generators/ckeditor_install/USAGE +7 -0
- data/generators/ckeditor_install/ckeditor_install_generator.rb +28 -0
- data/generators/ckeditor_install/templates/README +0 -0
- data/generators/ckeditor_install/templates/ckeditor.rb +56 -0
- data/generators/ckeditor_install/templates/ckeditor/CHANGES.html +993 -0
- data/generators/ckeditor_install/templates/ckeditor/INSTALL.html +92 -0
- data/generators/ckeditor_install/templates/ckeditor/LICENSE.html +1334 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/ajax.html +87 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/api.html +152 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/api_dialog.html +188 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/api_dialog/my_dialog.js +28 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/advanced.asp +105 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/events.asp +136 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/index.html +103 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/replace.asp +72 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/replaceall.asp +77 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/sample_posteddata.asp +46 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/asp/standalone.asp +72 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/assets/output_for_flash.fla +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/assets/output_for_flash.swf +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/assets/output_xhtml.css +204 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/assets/swfobject.js +18 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/autogrow.html +75 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/divreplace.html +137 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/enterkey.html +88 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/fullpage.html +62 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/index.html +57 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/jqueryadapter.html +73 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/output_for_flash.html +257 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/output_html.html +259 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/output_xhtml.html +159 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/php/advanced.php +93 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/php/events.php +130 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/php/replace.php +63 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/php/replaceall.php +68 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/php/standalone.php +64 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/replacebyclass.html +49 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/replacebycode.html +80 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/sample.css +81 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/sample.js +65 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/sample_posteddata.php +59 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/sharedspaces.html +131 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/skins.html +83 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/ui_color.html +87 -0
- data/generators/ckeditor_install/templates/ckeditor/_samples/ui_languages.html +103 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/adapters/jquery.js +297 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/_bootstrap.js +96 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/ajax.js +142 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/ckeditor.js +133 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/ckeditor_base.js +196 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/ckeditor_basic.js +239 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/command.js +209 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/commanddefinition.js +129 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/config.js +430 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dataprocessor.js +65 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom.js +20 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/comment.js +32 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/document.js +224 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/documentfragment.js +49 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/domobject.js +255 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/element.js +1564 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/elementpath.js +119 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/event.js +142 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/node.js +683 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/nodelist.js +26 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/range.js +1883 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/rangelist.js +214 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/text.js +123 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/walker.js +445 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dom/window.js +96 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/dtd.js +238 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/editor.js +924 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/editor_basic.js +182 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/env.js +270 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/event.js +342 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/eventInfo.js +120 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/focusmanager.js +152 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser.js +224 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/basicwriter.js +145 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/cdata.js +43 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/comment.js +60 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/element.js +240 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/filter.js +288 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/fragment.js +504 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/htmlparser/text.js +55 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/imagecacher.js +80 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/lang.js +156 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/loader.js +243 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/plugindefinition.js +66 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/plugins.js +85 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/resourcemanager.js +238 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/scriptloader.js +200 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/skins.js +212 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/themes.js +19 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/tools.js +734 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/ui.js +116 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/core/xml.js +165 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/_languages.js +83 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/_translationstatus.txt +60 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/af.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ar.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/bg.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/bn.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/bs.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ca.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/cs.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/cy.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/da.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/de.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/el.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/en-au.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/en-ca.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/en-gb.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/en.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/eo.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/es.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/et.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/eu.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/fa.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/fi.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/fo.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/fr-ca.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/fr.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/gl.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/gu.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/he.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/hi.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/hr.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/hu.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/is.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/it.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ja.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/km.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ko.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/lt.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/lv.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/mn.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ms.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/nb.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/nl.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/no.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/pl.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/pt-br.js +757 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/pt.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ro.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/ru.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/sk.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/sl.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/sr-latn.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/sr.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/sv.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/th.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/tr.js +757 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/uk.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/vi.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/zh-cn.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/lang/zh.js +758 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/a11yhelp/dialogs/a11yhelp.js +211 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/a11yhelp/lang/en.js +108 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/a11yhelp/lang/he.js +216 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/a11yhelp/plugin.js +46 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/about/dialogs/about.js +73 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/about/plugin.js +23 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/ajax_save/plugin.js +43 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js +384 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/attachment/images/attachment.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/attachment/lang/en.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/attachment/lang/ru.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/attachment/lang/uk.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/attachment/plugin.js +44 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/autogrow/plugin.js +86 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/basicstyles/plugin.js +101 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/bidi/plugin.js +259 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/blockquote/plugin.js +301 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/button/plugin.js +277 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/clipboard/dialogs/paste.js +205 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/clipboard/plugin.js +412 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/colorbutton/plugin.js +250 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js +336 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/colordialog/plugin.js +13 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/contextmenu/plugin.js +290 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/dialog/dialogDefinition.js +315 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/dialog/plugin.js +3015 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/dialogadvtab/plugin.js +213 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/dialogui/plugin.js +1523 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/div/dialogs/div.js +535 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/div/plugin.js +121 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/domiterator/plugin.js +356 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/editingblock/plugin.js +229 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/elementspath/plugin.js +206 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/embed/dialogs/embed.js +65 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/embed/images/embed.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/embed/lang/en.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/embed/lang/ru.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/embed/lang/uk.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/embed/plugin.js +43 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/enterkey/plugin.js +363 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/entities/plugin.js +226 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/fakeobjects/plugin.js +122 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/filebrowser/plugin.js +501 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/find/dialogs/find.js +890 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/find/plugin.js +46 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/flash/dialogs/flash.js +698 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/flash/images/placeholder.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/flash/plugin.js +168 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/floatpanel/plugin.js +402 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/font/plugin.js +234 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/format/plugin.js +194 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/button.js +135 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/checkbox.js +153 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/form.js +177 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/hiddenfield.js +98 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/radio.js +135 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/select.js +556 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/textarea.js +114 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/dialogs/textfield.js +199 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/images/hiddenfield.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/forms/plugin.js +284 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/horizontalrule/plugin.js +36 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/htmldataprocessor/plugin.js +502 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/htmlwriter/plugin.js +319 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/iframedialog/plugin.js +136 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/image/dialogs/image.js +1396 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/image/plugin.js +81 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/indent/plugin.js +455 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/justify/plugin.js +221 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/keystrokes/plugin.js +225 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/link/dialogs/anchor.js +99 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/link/dialogs/link.js +1424 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/link/images/anchor.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/link/plugin.js +238 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/list/plugin.js +710 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/listblock/plugin.js +257 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/liststyle/dialogs/liststyle.js +204 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/liststyle/plugin.js +66 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/maximize/plugin.js +350 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/menu/plugin.js +408 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/menubutton/plugin.js +94 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/newpage/plugin.js +53 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/pagebreak/plugin.js +121 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/panel/plugin.js +399 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/panelbutton/plugin.js +147 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/pastefromword/filter/default.js +1170 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/pastefromword/plugin.js +122 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/pastetext/dialogs/pastetext.js +70 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/pastetext/plugin.js +145 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/popup/plugin.js +64 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/preview/plugin.js +108 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/print/plugin.js +41 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/removeformat/plugin.js +184 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/resize/plugin.js +157 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/richcombo/plugin.js +370 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/save/plugin.js +55 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/scayt/dialogs/options.js +534 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/scayt/dialogs/toolbar.css +71 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/scayt/plugin.js +945 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/selection/plugin.js +1375 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_address.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_blockquote.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_div.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_h1.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_h2.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_h3.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_h4.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_h5.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_h6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_p.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/images/block_pre.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showblocks/plugin.js +155 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/showborders/plugin.js +201 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/dialogs/smiley.js +218 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/angel_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/angry_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/broken_heart.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/confused_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/cry_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/devil_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/envelope.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/heart.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/kiss.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/lightbulb.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/omg_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/regular_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/sad_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/shades_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/teeth_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/thumbs_down.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/thumbs_up.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/tounge_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/images/wink_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/smiley/plugin.js +94 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/sourcearea/plugin.js +207 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/specialchar/dialogs/specialchar.js +409 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/specialchar/plugin.js +29 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/styles/plugin.js +1479 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/styles/styles/default.js +88 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/stylescombo/plugin.js +206 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/tab/plugin.js +367 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/table/dialogs/table.js +672 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/table/plugin.js +78 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/tableresize/plugin.js +450 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js +533 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/tabletools/plugin.js +1120 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/templates/dialogs/templates.js +233 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/templates/plugin.js +99 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/templates/templates/default.js +94 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/templates/templates/images/template1.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/templates/templates/images/template2.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/templates/templates/images/template3.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/toolbar/plugin.js +481 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/dialogs/uicolor.js +205 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/lang/en.js +15 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/lang/he.js +15 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/plugin.js +37 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/uicolor.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/yui/assets/hue_bg.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/yui/assets/picker_mask.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/yui/assets/yui.css +15 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/uicolor/yui/yui.js +71 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/undo/plugin.js +554 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/wsc/dialogs/ciframe.html +49 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/wsc/dialogs/tmpFrameset.html +52 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/wsc/dialogs/wsc.css +82 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/wsc/dialogs/wsc.js +176 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/wsc/plugin.js +33 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/plugins/wysiwygarea/plugin.js +1146 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/dialog.css +882 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/editor.css +25 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/elementspath.css +73 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/icons.css +357 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/icons.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/icons_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/dialog_sides.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/dialog_sides.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/dialog_sides_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/mini.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/noimage.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/sprites.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/sprites_ie6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/images/toolbar_start.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/mainui.css +195 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/menu.css +216 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/panel.css +217 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/presets.css +49 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/reset.css +84 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/richcombo.css +277 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/skin.js +268 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/templates.css +88 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/kama/toolbar.css +409 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/dialog.css +785 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/editor.css +25 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/elementspath.css +74 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/icons.css +354 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/icons.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/icons_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/dialog_sides.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/dialog_sides.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/dialog_sides_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/mini.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/noimage.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/sprites.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/images/sprites_ie6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/mainui.css +145 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/menu.css +213 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/panel.css +212 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/presets.css +49 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/reset.css +84 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/richcombo.css +297 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/skin.js +81 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/templates.css +87 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/office2003/toolbar.css +470 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/dialog.css +800 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/editor.css +25 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/elementspath.css +74 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/icons.css +354 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/icons.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/icons_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/dialog_sides.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/dialog_sides.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/dialog_sides_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/mini.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/noimage.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/sprites.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/sprites_ie6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/images/toolbar_start.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/mainui.css +154 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/menu.css +215 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/panel.css +212 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/presets.css +50 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/reset.css +84 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/richcombo.css +297 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/skin.js +77 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/templates.css +87 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/skins/v2/toolbar.css +423 -0
- data/generators/ckeditor_install/templates/ckeditor/_source/themes/default/theme.js +361 -0
- data/generators/ckeditor_install/templates/ckeditor/adapters/jquery.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/ckeditor.js +137 -0
- data/generators/ckeditor_install/templates/ckeditor/ckeditor.pack +211 -0
- data/generators/ckeditor_install/templates/ckeditor/ckeditor_basic.js +8 -0
- data/generators/ckeditor_install/templates/ckeditor/ckeditor_basic_source.js +20 -0
- data/generators/ckeditor_install/templates/ckeditor/ckeditor_source.js +25 -0
- data/generators/ckeditor_install/templates/ckeditor/config.js +43 -0
- data/generators/ckeditor_install/templates/ckeditor/contents.css +39 -0
- data/generators/ckeditor_install/templates/ckeditor/css/ckfinder.css +299 -0
- data/generators/ckeditor_install/templates/ckeditor/css/fck_dialog.css +119 -0
- data/generators/ckeditor_install/templates/ckeditor/css/fck_editor.css +448 -0
- data/generators/ckeditor_install/templates/ckeditor/css/swfupload.css +94 -0
- data/generators/ckeditor_install/templates/ckeditor/images/add.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/cancelbutton.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/ckfnothumb.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/doc.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/mp3.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/pdf.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/rar.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/refresh.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/select_files.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/spacer.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/swf.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/toolbar.start.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/images/xls.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/_languages.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/_translationstatus.txt +60 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/af.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ar.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/bg.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/bn.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/bs.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ca.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/cs.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/cy.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/da.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/de.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/el.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/en-au.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/en-ca.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/en-gb.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/en.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/eo.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/es.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/et.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/eu.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/fa.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/fi.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/fo.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/fr-ca.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/fr.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/gl.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/gu.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/he.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/hi.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/hr.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/hu.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/is.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/it.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ja.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/km.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ko.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/lt.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/lv.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/mn.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ms.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/nb.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/nl.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/no.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/pl.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/pt-br.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/pt.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ro.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/ru.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/sk.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/sl.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/sr-latn.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/sr.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/sv.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/th.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/tr.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/uk.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/vi.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/zh-cn.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/lang/zh.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/a11yhelp/lang/en.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/a11yhelp/lang/he.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/about/dialogs/about.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/ajax_save/plugin.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/attachment/dialogs/attachment.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/attachment/images/attachment.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/attachment/lang/en.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/attachment/lang/ru.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/attachment/lang/uk.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/attachment/plugin.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/autogrow/plugin.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/clipboard/dialogs/paste.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/colordialog/dialogs/colordialog.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/div/dialogs/div.js +8 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/embed/dialogs/embed.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/embed/images/embed.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/embed/lang/en.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/embed/lang/ru.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/embed/lang/uk.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/embed/plugin.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/find/dialogs/find.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/flash/dialogs/flash.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/flash/images/placeholder.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/button.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/checkbox.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/form.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/hiddenfield.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/radio.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/select.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/textarea.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/dialogs/textfield.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/iframedialog/plugin.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/image/dialogs/image.js +13 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/link/dialogs/anchor.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/link/dialogs/link.js +11 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/link/images/anchor.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/liststyle/dialogs/liststyle.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/pastefromword/filter/default.js +10 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/pastetext/dialogs/pastetext.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/scayt/dialogs/options.js +8 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/scayt/dialogs/toolbar.css +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/dialogs/smiley.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/specialchar/dialogs/specialchar.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/styles/styles/default.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/table/dialogs/table.js +9 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/tableresize/plugin.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/tabletools/dialogs/tableCell.js +8 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/templates/dialogs/templates.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/templates/templates/default.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/dialogs/uicolor.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/lang/en.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/lang/he.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/plugin.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/uicolor.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/yui/assets/hue_bg.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/yui/assets/picker_mask.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/yui/assets/yui.css +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/uicolor/yui/yui.js +76 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/wsc/dialogs/ciframe.html +49 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/wsc/dialogs/wsc.css +6 -0
- data/generators/ckeditor_install/templates/ckeditor/plugins/wsc/dialogs/wsc.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/dialog.css +9 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/editor.css +12 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/icons.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/icons_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/dialog_sides.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/dialog_sides.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/mini.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/noimage.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/sprites.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/sprites_ie6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/images/toolbar_start.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/skin.js +7 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/kama/templates.css +6 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/dialog.css +9 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/editor.css +13 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/icons.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/icons_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/dialog_sides.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/dialog_sides.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/dialog_sides_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/mini.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/noimage.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/sprites.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/images/sprites_ie6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/skin.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/office2003/templates.css +6 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/dialog.css +9 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/editor.css +12 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/icons.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/icons_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/dialog_sides.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/dialog_sides.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/dialog_sides_rtl.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/mini.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/noimage.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/sprites.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/sprites_ie6.png +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/images/toolbar_start.gif +0 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/skin.js +6 -0
- data/generators/ckeditor_install/templates/ckeditor/skins/v2/templates.css +6 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/fileprogress.js +269 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/handlers.js +170 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/mootools-1.2.3-core-yc.js +356 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/querystring.js +40 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/swfupload.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/swfupload.queue.js +1 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/swfupload.swf +0 -0
- data/generators/ckeditor_install/templates/ckeditor/swfupload/swfupload.swfobject.js +111 -0
- data/generators/ckeditor_install/templates/ckeditor/themes/default/theme.js +8 -0
- data/generators/ckeditor_migration/USAGE +12 -0
- data/generators/ckeditor_migration/ckeditor_migration_generator.rb +36 -0
- data/generators/ckeditor_migration/templates/models/attachment_fu/asset.rb +32 -0
- data/generators/ckeditor_migration/templates/models/attachment_fu/attachment_file.rb +24 -0
- data/generators/ckeditor_migration/templates/models/attachment_fu/migration.rb +30 -0
- data/generators/ckeditor_migration/templates/models/attachment_fu/picture.rb +25 -0
- data/generators/ckeditor_migration/templates/models/paperclip/asset.rb +88 -0
- data/generators/ckeditor_migration/templates/models/paperclip/attachment_file.rb +40 -0
- data/generators/ckeditor_migration/templates/models/paperclip/migration.rb +31 -0
- data/generators/ckeditor_migration/templates/models/paperclip/picture.rb +23 -0
- data/lib/ckeditor.rb +89 -0
- data/lib/ckeditor/form_builder.rb +22 -0
- data/lib/ckeditor/formtastic.rb +12 -0
- data/lib/ckeditor/middleware.rb +18 -0
- data/lib/ckeditor/safe_buffer.rb +34 -0
- data/lib/ckeditor/utils.rb +19 -0
- data/lib/ckeditor/version.rb +11 -0
- data/lib/ckeditor/view_helper.rb +91 -0
- metadata +768 -0
@@ -0,0 +1,3015 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
For licensing, see LICENSE.html or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @fileOverview The floating dialog plugin.
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* No resize for this dialog.
|
12
|
+
* @constant
|
13
|
+
*/
|
14
|
+
CKEDITOR.DIALOG_RESIZE_NONE = 0;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Only allow horizontal resizing for this dialog, disable vertical resizing.
|
18
|
+
* @constant
|
19
|
+
*/
|
20
|
+
CKEDITOR.DIALOG_RESIZE_WIDTH = 1;
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Only allow vertical resizing for this dialog, disable horizontal resizing.
|
24
|
+
* @constant
|
25
|
+
*/
|
26
|
+
CKEDITOR.DIALOG_RESIZE_HEIGHT = 2;
|
27
|
+
|
28
|
+
/*
|
29
|
+
* Allow the dialog to be resized in both directions.
|
30
|
+
* @constant
|
31
|
+
*/
|
32
|
+
CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
33
|
+
|
34
|
+
(function()
|
35
|
+
{
|
36
|
+
var cssLength = CKEDITOR.tools.cssLength;
|
37
|
+
function isTabVisible( tabId )
|
38
|
+
{
|
39
|
+
return !!this._.tabs[ tabId ][ 0 ].$.offsetHeight;
|
40
|
+
}
|
41
|
+
|
42
|
+
function getPreviousVisibleTab()
|
43
|
+
{
|
44
|
+
var tabId = this._.currentTabId,
|
45
|
+
length = this._.tabIdList.length,
|
46
|
+
tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ) + length;
|
47
|
+
|
48
|
+
for ( var i = tabIndex - 1 ; i > tabIndex - length ; i-- )
|
49
|
+
{
|
50
|
+
if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) )
|
51
|
+
return this._.tabIdList[ i % length ];
|
52
|
+
}
|
53
|
+
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
|
57
|
+
function getNextVisibleTab()
|
58
|
+
{
|
59
|
+
var tabId = this._.currentTabId,
|
60
|
+
length = this._.tabIdList.length,
|
61
|
+
tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId );
|
62
|
+
|
63
|
+
for ( var i = tabIndex + 1 ; i < tabIndex + length ; i++ )
|
64
|
+
{
|
65
|
+
if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) )
|
66
|
+
return this._.tabIdList[ i % length ];
|
67
|
+
}
|
68
|
+
|
69
|
+
return null;
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
function clearOrRecoverTextInputValue( container, isRecover )
|
74
|
+
{
|
75
|
+
var inputs = container.$.getElementsByTagName( 'input' );
|
76
|
+
for ( var i = 0, length = inputs.length; i < length ; i++ )
|
77
|
+
{
|
78
|
+
var item = new CKEDITOR.dom.element( inputs[ i ] );
|
79
|
+
|
80
|
+
if ( item.getAttribute( 'type' ).toLowerCase() == 'text' )
|
81
|
+
{
|
82
|
+
if ( isRecover )
|
83
|
+
{
|
84
|
+
item.setAttribute( 'value', item.getCustomData( 'fake_value' ) || '' );
|
85
|
+
item.removeCustomData( 'fake_value' );
|
86
|
+
}
|
87
|
+
else
|
88
|
+
{
|
89
|
+
item.setCustomData( 'fake_value', item.getAttribute( 'value' ) );
|
90
|
+
item.setAttribute( 'value', '' );
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* This is the base class for runtime dialog objects. An instance of this
|
98
|
+
* class represents a single named dialog for a single editor instance.
|
99
|
+
* @param {Object} editor The editor which created the dialog.
|
100
|
+
* @param {String} dialogName The dialog's registered name.
|
101
|
+
* @constructor
|
102
|
+
* @example
|
103
|
+
* var dialogObj = new CKEDITOR.dialog( editor, 'smiley' );
|
104
|
+
*/
|
105
|
+
CKEDITOR.dialog = function( editor, dialogName )
|
106
|
+
{
|
107
|
+
// Load the dialog definition.
|
108
|
+
var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ];
|
109
|
+
|
110
|
+
// Completes the definition with the default values.
|
111
|
+
definition = CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition );
|
112
|
+
|
113
|
+
// Clone a functionally independent copy for this dialog.
|
114
|
+
definition = CKEDITOR.tools.clone( definition );
|
115
|
+
|
116
|
+
// Create a complex definition object, extending it with the API
|
117
|
+
// functions.
|
118
|
+
definition = new definitionObject( this, definition );
|
119
|
+
|
120
|
+
|
121
|
+
var doc = CKEDITOR.document;
|
122
|
+
|
123
|
+
var themeBuilt = editor.theme.buildDialog( editor );
|
124
|
+
|
125
|
+
// Initialize some basic parameters.
|
126
|
+
this._ =
|
127
|
+
{
|
128
|
+
editor : editor,
|
129
|
+
element : themeBuilt.element,
|
130
|
+
name : dialogName,
|
131
|
+
contentSize : { width : 0, height : 0 },
|
132
|
+
size : { width : 0, height : 0 },
|
133
|
+
updateSize : false,
|
134
|
+
contents : {},
|
135
|
+
buttons : {},
|
136
|
+
accessKeyMap : {},
|
137
|
+
|
138
|
+
// Initialize the tab and page map.
|
139
|
+
tabs : {},
|
140
|
+
tabIdList : [],
|
141
|
+
currentTabId : null,
|
142
|
+
currentTabIndex : null,
|
143
|
+
pageCount : 0,
|
144
|
+
lastTab : null,
|
145
|
+
tabBarMode : false,
|
146
|
+
|
147
|
+
// Initialize the tab order array for input widgets.
|
148
|
+
focusList : [],
|
149
|
+
currentFocusIndex : 0,
|
150
|
+
hasFocus : false
|
151
|
+
};
|
152
|
+
|
153
|
+
this.parts = themeBuilt.parts;
|
154
|
+
|
155
|
+
CKEDITOR.tools.setTimeout( function()
|
156
|
+
{
|
157
|
+
editor.fire( 'ariaWidget', this.parts.contents );
|
158
|
+
},
|
159
|
+
0, this );
|
160
|
+
|
161
|
+
// Set the startup styles for the dialog, avoiding it enlarging the
|
162
|
+
// page size on the dialog creation.
|
163
|
+
this.parts.dialog.setStyles(
|
164
|
+
{
|
165
|
+
position : CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed',
|
166
|
+
top : 0,
|
167
|
+
left: 0,
|
168
|
+
visibility : 'hidden'
|
169
|
+
});
|
170
|
+
|
171
|
+
// Call the CKEDITOR.event constructor to initialize this instance.
|
172
|
+
CKEDITOR.event.call( this );
|
173
|
+
|
174
|
+
// Fire the "dialogDefinition" event, making it possible to customize
|
175
|
+
// the dialog definition.
|
176
|
+
this.definition = definition = CKEDITOR.fire( 'dialogDefinition',
|
177
|
+
{
|
178
|
+
name : dialogName,
|
179
|
+
definition : definition
|
180
|
+
}
|
181
|
+
, editor ).definition;
|
182
|
+
// Initialize load, show, hide, ok and cancel events.
|
183
|
+
if ( definition.onLoad )
|
184
|
+
this.on( 'load', definition.onLoad );
|
185
|
+
|
186
|
+
if ( definition.onShow )
|
187
|
+
this.on( 'show', definition.onShow );
|
188
|
+
|
189
|
+
if ( definition.onHide )
|
190
|
+
this.on( 'hide', definition.onHide );
|
191
|
+
|
192
|
+
if ( definition.onOk )
|
193
|
+
{
|
194
|
+
this.on( 'ok', function( evt )
|
195
|
+
{
|
196
|
+
// Dialog confirm might probably introduce content changes (#5415).
|
197
|
+
editor.fire( 'saveSnapshot' );
|
198
|
+
setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 );
|
199
|
+
if ( definition.onOk.call( this, evt ) === false )
|
200
|
+
evt.data.hide = false;
|
201
|
+
});
|
202
|
+
}
|
203
|
+
|
204
|
+
if ( definition.onCancel )
|
205
|
+
{
|
206
|
+
this.on( 'cancel', function( evt )
|
207
|
+
{
|
208
|
+
if ( definition.onCancel.call( this, evt ) === false )
|
209
|
+
evt.data.hide = false;
|
210
|
+
});
|
211
|
+
}
|
212
|
+
|
213
|
+
var me = this;
|
214
|
+
|
215
|
+
// Iterates over all items inside all content in the dialog, calling a
|
216
|
+
// function for each of them.
|
217
|
+
var iterContents = function( func )
|
218
|
+
{
|
219
|
+
var contents = me._.contents,
|
220
|
+
stop = false;
|
221
|
+
|
222
|
+
for ( var i in contents )
|
223
|
+
{
|
224
|
+
for ( var j in contents[i] )
|
225
|
+
{
|
226
|
+
stop = func.call( this, contents[i][j] );
|
227
|
+
if ( stop )
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
};
|
232
|
+
|
233
|
+
this.on( 'ok', function( evt )
|
234
|
+
{
|
235
|
+
iterContents( function( item )
|
236
|
+
{
|
237
|
+
if ( item.validate )
|
238
|
+
{
|
239
|
+
var isValid = item.validate( this );
|
240
|
+
|
241
|
+
if ( typeof isValid == 'string' )
|
242
|
+
{
|
243
|
+
alert( isValid );
|
244
|
+
isValid = false;
|
245
|
+
}
|
246
|
+
|
247
|
+
if ( isValid === false )
|
248
|
+
{
|
249
|
+
if ( item.select )
|
250
|
+
item.select();
|
251
|
+
else
|
252
|
+
item.focus();
|
253
|
+
|
254
|
+
evt.data.hide = false;
|
255
|
+
evt.stop();
|
256
|
+
return true;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
});
|
260
|
+
}, this, null, 0 );
|
261
|
+
|
262
|
+
this.on( 'cancel', function( evt )
|
263
|
+
{
|
264
|
+
iterContents( function( item )
|
265
|
+
{
|
266
|
+
if ( item.isChanged() )
|
267
|
+
{
|
268
|
+
if ( !confirm( editor.lang.common.confirmCancel ) )
|
269
|
+
evt.data.hide = false;
|
270
|
+
return true;
|
271
|
+
}
|
272
|
+
});
|
273
|
+
}, this, null, 0 );
|
274
|
+
|
275
|
+
this.parts.close.on( 'click', function( evt )
|
276
|
+
{
|
277
|
+
if ( this.fire( 'cancel', { hide : true } ).hide !== false )
|
278
|
+
this.hide();
|
279
|
+
evt.data.preventDefault();
|
280
|
+
}, this );
|
281
|
+
|
282
|
+
// Sort focus list according to tab order definitions.
|
283
|
+
function setupFocus()
|
284
|
+
{
|
285
|
+
var focusList = me._.focusList;
|
286
|
+
focusList.sort( function( a, b )
|
287
|
+
{
|
288
|
+
// Mimics browser tab order logics;
|
289
|
+
if ( a.tabIndex != b.tabIndex )
|
290
|
+
return b.tabIndex - a.tabIndex;
|
291
|
+
// Sort is not stable in some browsers,
|
292
|
+
// fall-back the comparator to 'focusIndex';
|
293
|
+
else
|
294
|
+
return a.focusIndex - b.focusIndex;
|
295
|
+
});
|
296
|
+
|
297
|
+
var size = focusList.length;
|
298
|
+
for ( var i = 0; i < size; i++ )
|
299
|
+
focusList[ i ].focusIndex = i;
|
300
|
+
}
|
301
|
+
|
302
|
+
function changeFocus( forward )
|
303
|
+
{
|
304
|
+
var focusList = me._.focusList,
|
305
|
+
offset = forward ? 1 : -1;
|
306
|
+
if ( focusList.length < 1 )
|
307
|
+
return;
|
308
|
+
|
309
|
+
var current = me._.currentFocusIndex;
|
310
|
+
|
311
|
+
// Trigger the 'blur' event of any input element before anything,
|
312
|
+
// since certain UI updates may depend on it.
|
313
|
+
try
|
314
|
+
{
|
315
|
+
focusList[ current ].getInputElement().$.blur();
|
316
|
+
}
|
317
|
+
catch( e ){}
|
318
|
+
|
319
|
+
var startIndex = ( current + offset + focusList.length ) % focusList.length,
|
320
|
+
currentIndex = startIndex;
|
321
|
+
while ( !focusList[ currentIndex ].isFocusable() )
|
322
|
+
{
|
323
|
+
currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length;
|
324
|
+
if ( currentIndex == startIndex )
|
325
|
+
break;
|
326
|
+
}
|
327
|
+
focusList[ currentIndex ].focus();
|
328
|
+
|
329
|
+
// Select whole field content.
|
330
|
+
if ( focusList[ currentIndex ].type == 'text' )
|
331
|
+
focusList[ currentIndex ].select();
|
332
|
+
}
|
333
|
+
|
334
|
+
this.changeFocus = changeFocus;
|
335
|
+
|
336
|
+
var processed;
|
337
|
+
|
338
|
+
function focusKeydownHandler( evt )
|
339
|
+
{
|
340
|
+
// If I'm not the top dialog, ignore.
|
341
|
+
if ( me != CKEDITOR.dialog._.currentTop )
|
342
|
+
return;
|
343
|
+
|
344
|
+
var keystroke = evt.data.getKeystroke(),
|
345
|
+
rtl = editor.lang.dir == 'rtl';
|
346
|
+
|
347
|
+
processed = 0;
|
348
|
+
if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 )
|
349
|
+
{
|
350
|
+
var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 );
|
351
|
+
|
352
|
+
// Handling Tab and Shift-Tab.
|
353
|
+
if ( me._.tabBarMode )
|
354
|
+
{
|
355
|
+
// Change tabs.
|
356
|
+
var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me );
|
357
|
+
me.selectPage( nextId );
|
358
|
+
me._.tabs[ nextId ][ 0 ].focus();
|
359
|
+
}
|
360
|
+
else
|
361
|
+
{
|
362
|
+
// Change the focus of inputs.
|
363
|
+
changeFocus( !shiftPressed );
|
364
|
+
}
|
365
|
+
|
366
|
+
processed = 1;
|
367
|
+
}
|
368
|
+
else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 )
|
369
|
+
{
|
370
|
+
// Alt-F10 puts focus into the current tab item in the tab bar.
|
371
|
+
me._.tabBarMode = true;
|
372
|
+
me._.tabs[ me._.currentTabId ][ 0 ].focus();
|
373
|
+
processed = 1;
|
374
|
+
}
|
375
|
+
else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode )
|
376
|
+
{
|
377
|
+
// Arrow keys - used for changing tabs.
|
378
|
+
nextId = ( keystroke == ( rtl ? 39 : 37 ) ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) );
|
379
|
+
me.selectPage( nextId );
|
380
|
+
me._.tabs[ nextId ][ 0 ].focus();
|
381
|
+
processed = 1;
|
382
|
+
}
|
383
|
+
else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode )
|
384
|
+
{
|
385
|
+
this.selectPage( this._.currentTabId );
|
386
|
+
this._.tabBarMode = false;
|
387
|
+
this._.currentFocusIndex = -1;
|
388
|
+
changeFocus( true );
|
389
|
+
processed = 1;
|
390
|
+
}
|
391
|
+
|
392
|
+
if ( processed )
|
393
|
+
{
|
394
|
+
evt.stop();
|
395
|
+
evt.data.preventDefault();
|
396
|
+
}
|
397
|
+
}
|
398
|
+
|
399
|
+
function focusKeyPressHandler( evt )
|
400
|
+
{
|
401
|
+
processed && evt.data.preventDefault();
|
402
|
+
}
|
403
|
+
|
404
|
+
var dialogElement = this._.element;
|
405
|
+
// Add the dialog keyboard handlers.
|
406
|
+
this.on( 'show', function()
|
407
|
+
{
|
408
|
+
dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 );
|
409
|
+
// Some browsers instead, don't cancel key events in the keydown, but in the
|
410
|
+
// keypress. So we must do a longer trip in those cases. (#4531)
|
411
|
+
if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
|
412
|
+
dialogElement.on( 'keypress', focusKeyPressHandler, this );
|
413
|
+
|
414
|
+
} );
|
415
|
+
this.on( 'hide', function()
|
416
|
+
{
|
417
|
+
dialogElement.removeListener( 'keydown', focusKeydownHandler );
|
418
|
+
if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
|
419
|
+
dialogElement.removeListener( 'keypress', focusKeyPressHandler );
|
420
|
+
} );
|
421
|
+
this.on( 'iframeAdded', function( evt )
|
422
|
+
{
|
423
|
+
var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document );
|
424
|
+
doc.on( 'keydown', focusKeydownHandler, this, null, 0 );
|
425
|
+
} );
|
426
|
+
|
427
|
+
// Auto-focus logic in dialog.
|
428
|
+
this.on( 'show', function()
|
429
|
+
{
|
430
|
+
// Setup tabIndex on showing the dialog instead of on loading
|
431
|
+
// to allow dynamic tab order happen in dialog definition.
|
432
|
+
setupFocus();
|
433
|
+
|
434
|
+
if ( editor.config.dialog_startupFocusTab
|
435
|
+
&& me._.pageCount > 1 )
|
436
|
+
{
|
437
|
+
me._.tabBarMode = true;
|
438
|
+
me._.tabs[ me._.currentTabId ][ 0 ].focus();
|
439
|
+
}
|
440
|
+
else if ( !this._.hasFocus )
|
441
|
+
{
|
442
|
+
this._.currentFocusIndex = -1;
|
443
|
+
|
444
|
+
// Decide where to put the initial focus.
|
445
|
+
if ( definition.onFocus )
|
446
|
+
{
|
447
|
+
var initialFocus = definition.onFocus.call( this );
|
448
|
+
// Focus the field that the user specified.
|
449
|
+
initialFocus && initialFocus.focus();
|
450
|
+
}
|
451
|
+
// Focus the first field in layout order.
|
452
|
+
else
|
453
|
+
changeFocus( true );
|
454
|
+
|
455
|
+
/*
|
456
|
+
* IE BUG: If the initial focus went into a non-text element (e.g. button),
|
457
|
+
* then IE would still leave the caret inside the editing area.
|
458
|
+
*/
|
459
|
+
if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
|
460
|
+
{
|
461
|
+
var $selection = editor.document.$.selection,
|
462
|
+
$range = $selection.createRange();
|
463
|
+
|
464
|
+
if ( $range )
|
465
|
+
{
|
466
|
+
if ( $range.parentElement && $range.parentElement().ownerDocument == editor.document.$
|
467
|
+
|| $range.item && $range.item( 0 ).ownerDocument == editor.document.$ )
|
468
|
+
{
|
469
|
+
var $myRange = document.body.createTextRange();
|
470
|
+
$myRange.moveToElementText( this.getElement().getFirst().$ );
|
471
|
+
$myRange.collapse( true );
|
472
|
+
$myRange.select();
|
473
|
+
}
|
474
|
+
}
|
475
|
+
}
|
476
|
+
}
|
477
|
+
}, this, null, 0xffffffff );
|
478
|
+
|
479
|
+
// IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661).
|
480
|
+
// This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken.
|
481
|
+
if ( CKEDITOR.env.ie6Compat )
|
482
|
+
{
|
483
|
+
this.on( 'load', function( evt )
|
484
|
+
{
|
485
|
+
var outer = this.getElement(),
|
486
|
+
inner = outer.getFirst();
|
487
|
+
inner.remove();
|
488
|
+
inner.appendTo( outer );
|
489
|
+
}, this );
|
490
|
+
}
|
491
|
+
|
492
|
+
initDragAndDrop( this );
|
493
|
+
initResizeHandles( this );
|
494
|
+
|
495
|
+
// Insert the title.
|
496
|
+
( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title );
|
497
|
+
|
498
|
+
// Insert the tabs and contents.
|
499
|
+
for ( var i = 0 ; i < definition.contents.length ; i++ )
|
500
|
+
{
|
501
|
+
var page = definition.contents[i];
|
502
|
+
page && this.addPage( page );
|
503
|
+
}
|
504
|
+
|
505
|
+
this.parts[ 'tabs' ].on( 'click', function( evt )
|
506
|
+
{
|
507
|
+
var target = evt.data.getTarget();
|
508
|
+
// If we aren't inside a tab, bail out.
|
509
|
+
if ( target.hasClass( 'cke_dialog_tab' ) )
|
510
|
+
{
|
511
|
+
// Get the ID of the tab, without the 'cke_' prefix and the unique number suffix.
|
512
|
+
var id = target.$.id;
|
513
|
+
this.selectPage( id.substring( 4, id.lastIndexOf( '_' ) ) );
|
514
|
+
|
515
|
+
if ( this._.tabBarMode )
|
516
|
+
{
|
517
|
+
this._.tabBarMode = false;
|
518
|
+
this._.currentFocusIndex = -1;
|
519
|
+
changeFocus( true );
|
520
|
+
}
|
521
|
+
evt.data.preventDefault();
|
522
|
+
}
|
523
|
+
}, this );
|
524
|
+
|
525
|
+
// Insert buttons.
|
526
|
+
var buttonsHtml = [],
|
527
|
+
buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this,
|
528
|
+
{
|
529
|
+
type : 'hbox',
|
530
|
+
className : 'cke_dialog_footer_buttons',
|
531
|
+
widths : [],
|
532
|
+
children : definition.buttons
|
533
|
+
}, buttonsHtml ).getChild();
|
534
|
+
this.parts.footer.setHtml( buttonsHtml.join( '' ) );
|
535
|
+
|
536
|
+
for ( i = 0 ; i < buttons.length ; i++ )
|
537
|
+
this._.buttons[ buttons[i].id ] = buttons[i];
|
538
|
+
};
|
539
|
+
|
540
|
+
// Focusable interface. Use it via dialog.addFocusable.
|
541
|
+
function Focusable( dialog, element, index )
|
542
|
+
{
|
543
|
+
this.element = element;
|
544
|
+
this.focusIndex = index;
|
545
|
+
// TODO: support tabIndex for focusables.
|
546
|
+
this.tabIndex = 0;
|
547
|
+
this.isFocusable = function()
|
548
|
+
{
|
549
|
+
return !element.getAttribute( 'disabled' ) && element.isVisible();
|
550
|
+
};
|
551
|
+
this.focus = function()
|
552
|
+
{
|
553
|
+
dialog._.currentFocusIndex = this.focusIndex;
|
554
|
+
this.element.focus();
|
555
|
+
};
|
556
|
+
// Bind events
|
557
|
+
element.on( 'keydown', function( e )
|
558
|
+
{
|
559
|
+
if ( e.data.getKeystroke() in { 32:1, 13:1 } )
|
560
|
+
this.fire( 'click' );
|
561
|
+
} );
|
562
|
+
element.on( 'focus', function()
|
563
|
+
{
|
564
|
+
this.fire( 'mouseover' );
|
565
|
+
} );
|
566
|
+
element.on( 'blur', function()
|
567
|
+
{
|
568
|
+
this.fire( 'mouseout' );
|
569
|
+
} );
|
570
|
+
}
|
571
|
+
|
572
|
+
CKEDITOR.dialog.prototype =
|
573
|
+
{
|
574
|
+
destroy : function()
|
575
|
+
{
|
576
|
+
this.hide();
|
577
|
+
this._.element.remove();
|
578
|
+
},
|
579
|
+
|
580
|
+
/**
|
581
|
+
* Resizes the dialog.
|
582
|
+
* @param {Number} width The width of the dialog in pixels.
|
583
|
+
* @param {Number} height The height of the dialog in pixels.
|
584
|
+
* @function
|
585
|
+
* @example
|
586
|
+
* dialogObj.resize( 800, 640 );
|
587
|
+
*/
|
588
|
+
resize : (function()
|
589
|
+
{
|
590
|
+
return function( width, height )
|
591
|
+
{
|
592
|
+
if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height )
|
593
|
+
return;
|
594
|
+
|
595
|
+
CKEDITOR.dialog.fire( 'resize',
|
596
|
+
{
|
597
|
+
dialog : this,
|
598
|
+
skin : this._.editor.skinName,
|
599
|
+
width : width,
|
600
|
+
height : height
|
601
|
+
}, this._.editor );
|
602
|
+
|
603
|
+
this._.contentSize = { width : width, height : height };
|
604
|
+
this._.updateSize = true;
|
605
|
+
};
|
606
|
+
})(),
|
607
|
+
|
608
|
+
/**
|
609
|
+
* Gets the current size of the dialog in pixels.
|
610
|
+
* @returns {Object} An object with "width" and "height" properties.
|
611
|
+
* @example
|
612
|
+
* var width = dialogObj.getSize().width;
|
613
|
+
*/
|
614
|
+
getSize : function()
|
615
|
+
{
|
616
|
+
if ( !this._.updateSize )
|
617
|
+
return this._.size;
|
618
|
+
var element = this._.element.getFirst();
|
619
|
+
var size = this._.size = { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0};
|
620
|
+
|
621
|
+
// If either the offsetWidth or offsetHeight is 0, the element isn't visible.
|
622
|
+
this._.updateSize = !size.width || !size.height;
|
623
|
+
|
624
|
+
return size;
|
625
|
+
},
|
626
|
+
|
627
|
+
/**
|
628
|
+
* Moves the dialog to an (x, y) coordinate relative to the window.
|
629
|
+
* @function
|
630
|
+
* @param {Number} x The target x-coordinate.
|
631
|
+
* @param {Number} y The target y-coordinate.
|
632
|
+
* @example
|
633
|
+
* dialogObj.move( 10, 40 );
|
634
|
+
*/
|
635
|
+
move : (function()
|
636
|
+
{
|
637
|
+
var isFixed;
|
638
|
+
return function( x, y )
|
639
|
+
{
|
640
|
+
// The dialog may be fixed positioned or absolute positioned. Ask the
|
641
|
+
// browser what is the current situation first.
|
642
|
+
var element = this._.element.getFirst();
|
643
|
+
if ( isFixed === undefined )
|
644
|
+
isFixed = element.getComputedStyle( 'position' ) == 'fixed';
|
645
|
+
|
646
|
+
if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
|
647
|
+
return;
|
648
|
+
|
649
|
+
// Save the current position.
|
650
|
+
this._.position = { x : x, y : y };
|
651
|
+
|
652
|
+
// If not fixed positioned, add scroll position to the coordinates.
|
653
|
+
if ( !isFixed )
|
654
|
+
{
|
655
|
+
var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition();
|
656
|
+
x += scrollPosition.x;
|
657
|
+
y += scrollPosition.y;
|
658
|
+
}
|
659
|
+
|
660
|
+
element.setStyles(
|
661
|
+
{
|
662
|
+
'left' : ( x > 0 ? x : 0 ) + 'px',
|
663
|
+
'top' : ( y > 0 ? y : 0 ) + 'px'
|
664
|
+
});
|
665
|
+
};
|
666
|
+
})(),
|
667
|
+
|
668
|
+
/**
|
669
|
+
* Gets the dialog's position in the window.
|
670
|
+
* @returns {Object} An object with "x" and "y" properties.
|
671
|
+
* @example
|
672
|
+
* var dialogX = dialogObj.getPosition().x;
|
673
|
+
*/
|
674
|
+
getPosition : function(){ return CKEDITOR.tools.extend( {}, this._.position ); },
|
675
|
+
|
676
|
+
/**
|
677
|
+
* Shows the dialog box.
|
678
|
+
* @example
|
679
|
+
* dialogObj.show();
|
680
|
+
*/
|
681
|
+
show : function()
|
682
|
+
{
|
683
|
+
var editor = this._.editor;
|
684
|
+
if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
|
685
|
+
{
|
686
|
+
var selection = editor.getSelection();
|
687
|
+
selection && selection.lock();
|
688
|
+
}
|
689
|
+
|
690
|
+
// Insert the dialog's element to the root document.
|
691
|
+
var element = this._.element;
|
692
|
+
var definition = this.definition;
|
693
|
+
if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) )
|
694
|
+
element.appendTo( CKEDITOR.document.getBody() );
|
695
|
+
else
|
696
|
+
element.setStyle( 'display', 'block' );
|
697
|
+
|
698
|
+
// FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8.
|
699
|
+
if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 )
|
700
|
+
{
|
701
|
+
var dialogElement = this.parts.dialog;
|
702
|
+
dialogElement.setStyle( 'position', 'absolute' );
|
703
|
+
setTimeout( function()
|
704
|
+
{
|
705
|
+
dialogElement.setStyle( 'position', 'fixed' );
|
706
|
+
}, 0 );
|
707
|
+
}
|
708
|
+
|
709
|
+
|
710
|
+
// First, set the dialog to an appropriate size.
|
711
|
+
this.resize( definition.minWidth, definition.minHeight );
|
712
|
+
|
713
|
+
// Reset all inputs back to their default value.
|
714
|
+
this.reset();
|
715
|
+
|
716
|
+
// Select the first tab by default.
|
717
|
+
this.selectPage( this.definition.contents[0].id );
|
718
|
+
|
719
|
+
// Set z-index.
|
720
|
+
if ( CKEDITOR.dialog._.currentZIndex === null )
|
721
|
+
CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex;
|
722
|
+
this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 );
|
723
|
+
|
724
|
+
// Maintain the dialog ordering and dialog cover.
|
725
|
+
// Also register key handlers if first dialog.
|
726
|
+
if ( CKEDITOR.dialog._.currentTop === null )
|
727
|
+
{
|
728
|
+
CKEDITOR.dialog._.currentTop = this;
|
729
|
+
this._.parentDialog = null;
|
730
|
+
showCover( this._.editor );
|
731
|
+
|
732
|
+
element.on( 'keydown', accessKeyDownHandler );
|
733
|
+
element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
|
734
|
+
|
735
|
+
// Prevent some keys from bubbling up. (#4269)
|
736
|
+
for ( var event in { keyup :1, keydown :1, keypress :1 } )
|
737
|
+
element.on( event, preventKeyBubbling );
|
738
|
+
}
|
739
|
+
else
|
740
|
+
{
|
741
|
+
this._.parentDialog = CKEDITOR.dialog._.currentTop;
|
742
|
+
var parentElement = this._.parentDialog.getElement().getFirst();
|
743
|
+
parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 );
|
744
|
+
CKEDITOR.dialog._.currentTop = this;
|
745
|
+
}
|
746
|
+
|
747
|
+
// Register the Esc hotkeys.
|
748
|
+
registerAccessKey( this, this, '\x1b', null, function()
|
749
|
+
{
|
750
|
+
this.getButton( 'cancel' ) && this.getButton( 'cancel' ).click();
|
751
|
+
} );
|
752
|
+
|
753
|
+
// Reset the hasFocus state.
|
754
|
+
this._.hasFocus = false;
|
755
|
+
|
756
|
+
// Rearrange the dialog to the middle of the window.
|
757
|
+
CKEDITOR.tools.setTimeout( function()
|
758
|
+
{
|
759
|
+
var viewSize = CKEDITOR.document.getWindow().getViewPaneSize();
|
760
|
+
var dialogSize = this.getSize();
|
761
|
+
|
762
|
+
// We're using definition size for initial position because of
|
763
|
+
// offten corrupted data in offsetWidth at this point. (#4084)
|
764
|
+
this.move( ( viewSize.width - definition.minWidth ) / 2, ( viewSize.height - dialogSize.height ) / 2 );
|
765
|
+
|
766
|
+
this.parts.dialog.setStyle( 'visibility', '' );
|
767
|
+
|
768
|
+
// Execute onLoad for the first show.
|
769
|
+
this.fireOnce( 'load', {} );
|
770
|
+
this.fire( 'show', {} );
|
771
|
+
this._.editor.fire( 'dialogShow', this );
|
772
|
+
|
773
|
+
// Save the initial values of the dialog.
|
774
|
+
this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } );
|
775
|
+
|
776
|
+
},
|
777
|
+
100, this );
|
778
|
+
},
|
779
|
+
|
780
|
+
/**
|
781
|
+
* Executes a function for each UI element.
|
782
|
+
* @param {Function} fn Function to execute for each UI element.
|
783
|
+
* @returns {CKEDITOR.dialog} The current dialog object.
|
784
|
+
*/
|
785
|
+
foreach : function( fn )
|
786
|
+
{
|
787
|
+
for ( var i in this._.contents )
|
788
|
+
{
|
789
|
+
for ( var j in this._.contents[i] )
|
790
|
+
fn( this._.contents[i][j] );
|
791
|
+
}
|
792
|
+
return this;
|
793
|
+
},
|
794
|
+
|
795
|
+
/**
|
796
|
+
* Resets all input values in the dialog.
|
797
|
+
* @example
|
798
|
+
* dialogObj.reset();
|
799
|
+
* @returns {CKEDITOR.dialog} The current dialog object.
|
800
|
+
*/
|
801
|
+
reset : (function()
|
802
|
+
{
|
803
|
+
var fn = function( widget ){ if ( widget.reset ) widget.reset( 1 ); };
|
804
|
+
return function(){ this.foreach( fn ); return this; };
|
805
|
+
})(),
|
806
|
+
|
807
|
+
setupContent : function()
|
808
|
+
{
|
809
|
+
var args = arguments;
|
810
|
+
this.foreach( function( widget )
|
811
|
+
{
|
812
|
+
if ( widget.setup )
|
813
|
+
widget.setup.apply( widget, args );
|
814
|
+
});
|
815
|
+
},
|
816
|
+
|
817
|
+
commitContent : function()
|
818
|
+
{
|
819
|
+
var args = arguments;
|
820
|
+
this.foreach( function( widget )
|
821
|
+
{
|
822
|
+
if ( widget.commit )
|
823
|
+
widget.commit.apply( widget, args );
|
824
|
+
});
|
825
|
+
},
|
826
|
+
|
827
|
+
/**
|
828
|
+
* Hides the dialog box.
|
829
|
+
* @example
|
830
|
+
* dialogObj.hide();
|
831
|
+
*/
|
832
|
+
hide : function()
|
833
|
+
{
|
834
|
+
if ( !this.parts.dialog.isVisible() )
|
835
|
+
return;
|
836
|
+
|
837
|
+
this.fire( 'hide', {} );
|
838
|
+
this._.editor.fire( 'dialogHide', this );
|
839
|
+
var element = this._.element;
|
840
|
+
element.setStyle( 'display', 'none' );
|
841
|
+
this.parts.dialog.setStyle( 'visibility', 'hidden' );
|
842
|
+
// Unregister all access keys associated with this dialog.
|
843
|
+
unregisterAccessKey( this );
|
844
|
+
|
845
|
+
// Close any child(top) dialogs first.
|
846
|
+
while( CKEDITOR.dialog._.currentTop != this )
|
847
|
+
CKEDITOR.dialog._.currentTop.hide();
|
848
|
+
|
849
|
+
// Maintain dialog ordering and remove cover if needed.
|
850
|
+
if ( !this._.parentDialog )
|
851
|
+
hideCover();
|
852
|
+
else
|
853
|
+
{
|
854
|
+
var parentElement = this._.parentDialog.getElement().getFirst();
|
855
|
+
parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) );
|
856
|
+
}
|
857
|
+
CKEDITOR.dialog._.currentTop = this._.parentDialog;
|
858
|
+
|
859
|
+
// Deduct or clear the z-index.
|
860
|
+
if ( !this._.parentDialog )
|
861
|
+
{
|
862
|
+
CKEDITOR.dialog._.currentZIndex = null;
|
863
|
+
|
864
|
+
// Remove access key handlers.
|
865
|
+
element.removeListener( 'keydown', accessKeyDownHandler );
|
866
|
+
element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
|
867
|
+
|
868
|
+
// Remove bubbling-prevention handler. (#4269)
|
869
|
+
for ( var event in { keyup :1, keydown :1, keypress :1 } )
|
870
|
+
element.removeListener( event, preventKeyBubbling );
|
871
|
+
|
872
|
+
var editor = this._.editor;
|
873
|
+
editor.focus();
|
874
|
+
|
875
|
+
if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
|
876
|
+
{
|
877
|
+
var selection = editor.getSelection();
|
878
|
+
selection && selection.unlock( true );
|
879
|
+
}
|
880
|
+
}
|
881
|
+
else
|
882
|
+
CKEDITOR.dialog._.currentZIndex -= 10;
|
883
|
+
|
884
|
+
delete this._.parentDialog;
|
885
|
+
// Reset the initial values of the dialog.
|
886
|
+
this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } );
|
887
|
+
},
|
888
|
+
|
889
|
+
/**
|
890
|
+
* Adds a tabbed page into the dialog.
|
891
|
+
* @param {Object} contents Content definition.
|
892
|
+
* @example
|
893
|
+
*/
|
894
|
+
addPage : function( contents )
|
895
|
+
{
|
896
|
+
var pageHtml = [],
|
897
|
+
titleHtml = contents.label ? ' title="' + CKEDITOR.tools.htmlEncode( contents.label ) + '"' : '',
|
898
|
+
elements = contents.elements,
|
899
|
+
vbox = CKEDITOR.dialog._.uiElementBuilders.vbox.build( this,
|
900
|
+
{
|
901
|
+
type : 'vbox',
|
902
|
+
className : 'cke_dialog_page_contents',
|
903
|
+
children : contents.elements,
|
904
|
+
expand : !!contents.expand,
|
905
|
+
padding : contents.padding,
|
906
|
+
style : contents.style || 'width: 100%; height: 100%;'
|
907
|
+
}, pageHtml );
|
908
|
+
|
909
|
+
// Create the HTML for the tab and the content block.
|
910
|
+
var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) );
|
911
|
+
page.setAttribute( 'role', 'tabpanel' );
|
912
|
+
|
913
|
+
var env = CKEDITOR.env;
|
914
|
+
var tabId = 'cke_' + contents.id + '_' + CKEDITOR.tools.getNextNumber(),
|
915
|
+
tab = CKEDITOR.dom.element.createFromHtml( [
|
916
|
+
'<a class="cke_dialog_tab"',
|
917
|
+
( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ),
|
918
|
+
titleHtml,
|
919
|
+
( !!contents.hidden ? ' style="display:none"' : '' ),
|
920
|
+
' id="', tabId, '"',
|
921
|
+
env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"',
|
922
|
+
' tabIndex="-1"',
|
923
|
+
' hidefocus="true"',
|
924
|
+
' role="tab">',
|
925
|
+
contents.label,
|
926
|
+
'</a>'
|
927
|
+
].join( '' ) );
|
928
|
+
|
929
|
+
page.setAttribute( 'aria-labelledby', tabId );
|
930
|
+
|
931
|
+
// Take records for the tabs and elements created.
|
932
|
+
this._.tabs[ contents.id ] = [ tab, page ];
|
933
|
+
this._.tabIdList.push( contents.id );
|
934
|
+
!contents.hidden && this._.pageCount++;
|
935
|
+
this._.lastTab = tab;
|
936
|
+
this.updateStyle();
|
937
|
+
|
938
|
+
var contentMap = this._.contents[ contents.id ] = {},
|
939
|
+
cursor,
|
940
|
+
children = vbox.getChild();
|
941
|
+
|
942
|
+
while ( ( cursor = children.shift() ) )
|
943
|
+
{
|
944
|
+
contentMap[ cursor.id ] = cursor;
|
945
|
+
if ( typeof( cursor.getChild ) == 'function' )
|
946
|
+
children.push.apply( children, cursor.getChild() );
|
947
|
+
}
|
948
|
+
|
949
|
+
// Attach the DOM nodes.
|
950
|
+
|
951
|
+
page.setAttribute( 'name', contents.id );
|
952
|
+
page.appendTo( this.parts.contents );
|
953
|
+
|
954
|
+
tab.unselectable();
|
955
|
+
this.parts.tabs.append( tab );
|
956
|
+
|
957
|
+
// Add access key handlers if access key is defined.
|
958
|
+
if ( contents.accessKey )
|
959
|
+
{
|
960
|
+
registerAccessKey( this, this, 'CTRL+' + contents.accessKey,
|
961
|
+
tabAccessKeyDown, tabAccessKeyUp );
|
962
|
+
this._.accessKeyMap[ 'CTRL+' + contents.accessKey ] = contents.id;
|
963
|
+
}
|
964
|
+
},
|
965
|
+
|
966
|
+
/**
|
967
|
+
* Activates a tab page in the dialog by its id.
|
968
|
+
* @param {String} id The id of the dialog tab to be activated.
|
969
|
+
* @example
|
970
|
+
* dialogObj.selectPage( 'tab_1' );
|
971
|
+
*/
|
972
|
+
selectPage : function( id )
|
973
|
+
{
|
974
|
+
if ( this._.currentTabId == id )
|
975
|
+
return;
|
976
|
+
|
977
|
+
// Returning true means that the event has been canceled
|
978
|
+
if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true )
|
979
|
+
return;
|
980
|
+
|
981
|
+
// Hide the non-selected tabs and pages.
|
982
|
+
for ( var i in this._.tabs )
|
983
|
+
{
|
984
|
+
var tab = this._.tabs[i][0],
|
985
|
+
page = this._.tabs[i][1];
|
986
|
+
if ( i != id )
|
987
|
+
{
|
988
|
+
tab.removeClass( 'cke_dialog_tab_selected' );
|
989
|
+
page.hide();
|
990
|
+
}
|
991
|
+
page.setAttribute( 'aria-hidden', i != id );
|
992
|
+
}
|
993
|
+
|
994
|
+
var selected = this._.tabs[ id ];
|
995
|
+
selected[ 0 ].addClass( 'cke_dialog_tab_selected' );
|
996
|
+
|
997
|
+
// [IE] an invisible input[type='text'] will enlarge it's width
|
998
|
+
// if it's value is long when it shows, so we clear it's value
|
999
|
+
// before it shows and then recover it (#5649)
|
1000
|
+
if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat )
|
1001
|
+
{
|
1002
|
+
clearOrRecoverTextInputValue( selected[ 1 ] );
|
1003
|
+
selected[ 1 ].show();
|
1004
|
+
setTimeout( function()
|
1005
|
+
{
|
1006
|
+
clearOrRecoverTextInputValue( selected[ 1 ], 1 );
|
1007
|
+
}, 0 );
|
1008
|
+
}
|
1009
|
+
else
|
1010
|
+
selected[ 1 ].show();
|
1011
|
+
|
1012
|
+
this._.currentTabId = id;
|
1013
|
+
this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id );
|
1014
|
+
},
|
1015
|
+
|
1016
|
+
// Dialog state-specific style updates.
|
1017
|
+
updateStyle : function()
|
1018
|
+
{
|
1019
|
+
// If only a single page shown, a different style is used in the central pane.
|
1020
|
+
this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' );
|
1021
|
+
},
|
1022
|
+
|
1023
|
+
/**
|
1024
|
+
* Hides a page's tab away from the dialog.
|
1025
|
+
* @param {String} id The page's Id.
|
1026
|
+
* @example
|
1027
|
+
* dialog.hidePage( 'tab_3' );
|
1028
|
+
*/
|
1029
|
+
hidePage : function( id )
|
1030
|
+
{
|
1031
|
+
var tab = this._.tabs[id] && this._.tabs[id][0];
|
1032
|
+
if ( !tab || this._.pageCount == 1 )
|
1033
|
+
return;
|
1034
|
+
// Switch to other tab first when we're hiding the active tab.
|
1035
|
+
else if ( id == this._.currentTabId )
|
1036
|
+
this.selectPage( getPreviousVisibleTab.call( this ) );
|
1037
|
+
|
1038
|
+
tab.hide();
|
1039
|
+
this._.pageCount--;
|
1040
|
+
this.updateStyle();
|
1041
|
+
},
|
1042
|
+
|
1043
|
+
/**
|
1044
|
+
* Unhides a page's tab.
|
1045
|
+
* @param {String} id The page's Id.
|
1046
|
+
* @example
|
1047
|
+
* dialog.showPage( 'tab_2' );
|
1048
|
+
*/
|
1049
|
+
showPage : function( id )
|
1050
|
+
{
|
1051
|
+
var tab = this._.tabs[id] && this._.tabs[id][0];
|
1052
|
+
if ( !tab )
|
1053
|
+
return;
|
1054
|
+
tab.show();
|
1055
|
+
this._.pageCount++;
|
1056
|
+
this.updateStyle();
|
1057
|
+
},
|
1058
|
+
|
1059
|
+
/**
|
1060
|
+
* Gets the root DOM element of the dialog.
|
1061
|
+
* @returns {CKEDITOR.dom.element} The <span> element containing this dialog.
|
1062
|
+
* @example
|
1063
|
+
* var dialogElement = dialogObj.getElement().getFirst();
|
1064
|
+
* dialogElement.setStyle( 'padding', '5px' );
|
1065
|
+
*/
|
1066
|
+
getElement : function()
|
1067
|
+
{
|
1068
|
+
return this._.element;
|
1069
|
+
},
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* Gets the name of the dialog.
|
1073
|
+
* @returns {String} The name of this dialog.
|
1074
|
+
* @example
|
1075
|
+
* var dialogName = dialogObj.getName();
|
1076
|
+
*/
|
1077
|
+
getName : function()
|
1078
|
+
{
|
1079
|
+
return this._.name;
|
1080
|
+
},
|
1081
|
+
|
1082
|
+
/**
|
1083
|
+
* Gets a dialog UI element object from a dialog page.
|
1084
|
+
* @param {String} pageId id of dialog page.
|
1085
|
+
* @param {String} elementId id of UI element.
|
1086
|
+
* @example
|
1087
|
+
* @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element.
|
1088
|
+
*/
|
1089
|
+
getContentElement : function( pageId, elementId )
|
1090
|
+
{
|
1091
|
+
var page = this._.contents[ pageId ];
|
1092
|
+
return page && page[ elementId ];
|
1093
|
+
},
|
1094
|
+
|
1095
|
+
/**
|
1096
|
+
* Gets the value of a dialog UI element.
|
1097
|
+
* @param {String} pageId id of dialog page.
|
1098
|
+
* @param {String} elementId id of UI element.
|
1099
|
+
* @example
|
1100
|
+
* @returns {Object} The value of the UI element.
|
1101
|
+
*/
|
1102
|
+
getValueOf : function( pageId, elementId )
|
1103
|
+
{
|
1104
|
+
return this.getContentElement( pageId, elementId ).getValue();
|
1105
|
+
},
|
1106
|
+
|
1107
|
+
/**
|
1108
|
+
* Sets the value of a dialog UI element.
|
1109
|
+
* @param {String} pageId id of the dialog page.
|
1110
|
+
* @param {String} elementId id of the UI element.
|
1111
|
+
* @param {Object} value The new value of the UI element.
|
1112
|
+
* @example
|
1113
|
+
*/
|
1114
|
+
setValueOf : function( pageId, elementId, value )
|
1115
|
+
{
|
1116
|
+
return this.getContentElement( pageId, elementId ).setValue( value );
|
1117
|
+
},
|
1118
|
+
|
1119
|
+
/**
|
1120
|
+
* Gets the UI element of a button in the dialog's button row.
|
1121
|
+
* @param {String} id The id of the button.
|
1122
|
+
* @example
|
1123
|
+
* @returns {CKEDITOR.ui.dialog.button} The button object.
|
1124
|
+
*/
|
1125
|
+
getButton : function( id )
|
1126
|
+
{
|
1127
|
+
return this._.buttons[ id ];
|
1128
|
+
},
|
1129
|
+
|
1130
|
+
/**
|
1131
|
+
* Simulates a click to a dialog button in the dialog's button row.
|
1132
|
+
* @param {String} id The id of the button.
|
1133
|
+
* @example
|
1134
|
+
* @returns The return value of the dialog's "click" event.
|
1135
|
+
*/
|
1136
|
+
click : function( id )
|
1137
|
+
{
|
1138
|
+
return this._.buttons[ id ].click();
|
1139
|
+
},
|
1140
|
+
|
1141
|
+
/**
|
1142
|
+
* Disables a dialog button.
|
1143
|
+
* @param {String} id The id of the button.
|
1144
|
+
* @example
|
1145
|
+
*/
|
1146
|
+
disableButton : function( id )
|
1147
|
+
{
|
1148
|
+
return this._.buttons[ id ].disable();
|
1149
|
+
},
|
1150
|
+
|
1151
|
+
/**
|
1152
|
+
* Enables a dialog button.
|
1153
|
+
* @param {String} id The id of the button.
|
1154
|
+
* @example
|
1155
|
+
*/
|
1156
|
+
enableButton : function( id )
|
1157
|
+
{
|
1158
|
+
return this._.buttons[ id ].enable();
|
1159
|
+
},
|
1160
|
+
|
1161
|
+
/**
|
1162
|
+
* Gets the number of pages in the dialog.
|
1163
|
+
* @returns {Number} Page count.
|
1164
|
+
*/
|
1165
|
+
getPageCount : function()
|
1166
|
+
{
|
1167
|
+
return this._.pageCount;
|
1168
|
+
},
|
1169
|
+
|
1170
|
+
/**
|
1171
|
+
* Gets the editor instance which opened this dialog.
|
1172
|
+
* @returns {CKEDITOR.editor} Parent editor instances.
|
1173
|
+
*/
|
1174
|
+
getParentEditor : function()
|
1175
|
+
{
|
1176
|
+
return this._.editor;
|
1177
|
+
},
|
1178
|
+
|
1179
|
+
/**
|
1180
|
+
* Gets the element that was selected when opening the dialog, if any.
|
1181
|
+
* @returns {CKEDITOR.dom.element} The element that was selected, or null.
|
1182
|
+
*/
|
1183
|
+
getSelectedElement : function()
|
1184
|
+
{
|
1185
|
+
return this.getParentEditor().getSelection().getSelectedElement();
|
1186
|
+
},
|
1187
|
+
|
1188
|
+
/**
|
1189
|
+
* Adds element to dialog's focusable list.
|
1190
|
+
*
|
1191
|
+
* @param {CKEDITOR.dom.element} element
|
1192
|
+
* @param {Number} [index]
|
1193
|
+
*/
|
1194
|
+
addFocusable: function( element, index ) {
|
1195
|
+
if ( typeof index == 'undefined' )
|
1196
|
+
{
|
1197
|
+
index = this._.focusList.length;
|
1198
|
+
this._.focusList.push( new Focusable( this, element, index ) );
|
1199
|
+
}
|
1200
|
+
else
|
1201
|
+
{
|
1202
|
+
this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
|
1203
|
+
for ( var i = index + 1 ; i < this._.focusList.length ; i++ )
|
1204
|
+
this._.focusList[ i ].focusIndex++;
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
};
|
1208
|
+
|
1209
|
+
CKEDITOR.tools.extend( CKEDITOR.dialog,
|
1210
|
+
/**
|
1211
|
+
* @lends CKEDITOR.dialog
|
1212
|
+
*/
|
1213
|
+
{
|
1214
|
+
/**
|
1215
|
+
* Registers a dialog.
|
1216
|
+
* @param {String} name The dialog's name.
|
1217
|
+
* @param {Function|String} dialogDefinition
|
1218
|
+
* A function returning the dialog's definition, or the URL to the .js file holding the function.
|
1219
|
+
* The function should accept an argument "editor" which is the current editor instance, and
|
1220
|
+
* return an object conforming to {@link CKEDITOR.dialog.dialogDefinition}.
|
1221
|
+
* @example
|
1222
|
+
* @see CKEDITOR.dialog.dialogDefinition
|
1223
|
+
*/
|
1224
|
+
add : function( name, dialogDefinition )
|
1225
|
+
{
|
1226
|
+
// Avoid path registration from multiple instances override definition.
|
1227
|
+
if ( !this._.dialogDefinitions[name]
|
1228
|
+
|| typeof dialogDefinition == 'function' )
|
1229
|
+
this._.dialogDefinitions[name] = dialogDefinition;
|
1230
|
+
},
|
1231
|
+
|
1232
|
+
exists : function( name )
|
1233
|
+
{
|
1234
|
+
return !!this._.dialogDefinitions[ name ];
|
1235
|
+
},
|
1236
|
+
|
1237
|
+
getCurrent : function()
|
1238
|
+
{
|
1239
|
+
return CKEDITOR.dialog._.currentTop;
|
1240
|
+
},
|
1241
|
+
|
1242
|
+
/**
|
1243
|
+
* The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds.
|
1244
|
+
* @static
|
1245
|
+
* @field
|
1246
|
+
* @example
|
1247
|
+
* @type Function
|
1248
|
+
*/
|
1249
|
+
okButton : (function()
|
1250
|
+
{
|
1251
|
+
var retval = function( editor, override )
|
1252
|
+
{
|
1253
|
+
override = override || {};
|
1254
|
+
return CKEDITOR.tools.extend( {
|
1255
|
+
id : 'ok',
|
1256
|
+
type : 'button',
|
1257
|
+
label : editor.lang.common.ok,
|
1258
|
+
'class' : 'cke_dialog_ui_button_ok',
|
1259
|
+
onClick : function( evt )
|
1260
|
+
{
|
1261
|
+
var dialog = evt.data.dialog;
|
1262
|
+
if ( dialog.fire( 'ok', { hide : true } ).hide !== false )
|
1263
|
+
dialog.hide();
|
1264
|
+
}
|
1265
|
+
}, override, true );
|
1266
|
+
};
|
1267
|
+
retval.type = 'button';
|
1268
|
+
retval.override = function( override )
|
1269
|
+
{
|
1270
|
+
return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); },
|
1271
|
+
{ type : 'button' }, true );
|
1272
|
+
};
|
1273
|
+
return retval;
|
1274
|
+
})(),
|
1275
|
+
|
1276
|
+
/**
|
1277
|
+
* The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed.
|
1278
|
+
* @static
|
1279
|
+
* @field
|
1280
|
+
* @example
|
1281
|
+
* @type Function
|
1282
|
+
*/
|
1283
|
+
cancelButton : (function()
|
1284
|
+
{
|
1285
|
+
var retval = function( editor, override )
|
1286
|
+
{
|
1287
|
+
override = override || {};
|
1288
|
+
return CKEDITOR.tools.extend( {
|
1289
|
+
id : 'cancel',
|
1290
|
+
type : 'button',
|
1291
|
+
label : editor.lang.common.cancel,
|
1292
|
+
'class' : 'cke_dialog_ui_button_cancel',
|
1293
|
+
onClick : function( evt )
|
1294
|
+
{
|
1295
|
+
var dialog = evt.data.dialog;
|
1296
|
+
if ( dialog.fire( 'cancel', { hide : true } ).hide !== false )
|
1297
|
+
dialog.hide();
|
1298
|
+
}
|
1299
|
+
}, override, true );
|
1300
|
+
};
|
1301
|
+
retval.type = 'button';
|
1302
|
+
retval.override = function( override )
|
1303
|
+
{
|
1304
|
+
return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); },
|
1305
|
+
{ type : 'button' }, true );
|
1306
|
+
};
|
1307
|
+
return retval;
|
1308
|
+
})(),
|
1309
|
+
|
1310
|
+
/**
|
1311
|
+
* Registers a dialog UI element.
|
1312
|
+
* @param {String} typeName The name of the UI element.
|
1313
|
+
* @param {Function} builder The function to build the UI element.
|
1314
|
+
* @example
|
1315
|
+
*/
|
1316
|
+
addUIElement : function( typeName, builder )
|
1317
|
+
{
|
1318
|
+
this._.uiElementBuilders[ typeName ] = builder;
|
1319
|
+
}
|
1320
|
+
});
|
1321
|
+
|
1322
|
+
CKEDITOR.dialog._ =
|
1323
|
+
{
|
1324
|
+
uiElementBuilders : {},
|
1325
|
+
|
1326
|
+
dialogDefinitions : {},
|
1327
|
+
|
1328
|
+
currentTop : null,
|
1329
|
+
|
1330
|
+
currentZIndex : null
|
1331
|
+
};
|
1332
|
+
|
1333
|
+
// "Inherit" (copy actually) from CKEDITOR.event.
|
1334
|
+
CKEDITOR.event.implementOn( CKEDITOR.dialog );
|
1335
|
+
CKEDITOR.event.implementOn( CKEDITOR.dialog.prototype, true );
|
1336
|
+
|
1337
|
+
var defaultDialogDefinition =
|
1338
|
+
{
|
1339
|
+
resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
|
1340
|
+
minWidth : 600,
|
1341
|
+
minHeight : 400,
|
1342
|
+
buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ]
|
1343
|
+
};
|
1344
|
+
|
1345
|
+
// The buttons in MacOS Apps are in reverse order #4750
|
1346
|
+
CKEDITOR.env.mac && defaultDialogDefinition.buttons.reverse();
|
1347
|
+
|
1348
|
+
// Tool function used to return an item from an array based on its id
|
1349
|
+
// property.
|
1350
|
+
var getById = function( array, id, recurse )
|
1351
|
+
{
|
1352
|
+
for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
|
1353
|
+
{
|
1354
|
+
if ( item.id == id )
|
1355
|
+
return item;
|
1356
|
+
if ( recurse && item[ recurse ] )
|
1357
|
+
{
|
1358
|
+
var retval = getById( item[ recurse ], id, recurse ) ;
|
1359
|
+
if ( retval )
|
1360
|
+
return retval;
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
return null;
|
1364
|
+
};
|
1365
|
+
|
1366
|
+
// Tool function used to add an item into an array.
|
1367
|
+
var addById = function( array, newItem, nextSiblingId, recurse, nullIfNotFound )
|
1368
|
+
{
|
1369
|
+
if ( nextSiblingId )
|
1370
|
+
{
|
1371
|
+
for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
|
1372
|
+
{
|
1373
|
+
if ( item.id == nextSiblingId )
|
1374
|
+
{
|
1375
|
+
array.splice( i, 0, newItem );
|
1376
|
+
return newItem;
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
if ( recurse && item[ recurse ] )
|
1380
|
+
{
|
1381
|
+
var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true );
|
1382
|
+
if ( retval )
|
1383
|
+
return retval;
|
1384
|
+
}
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
if ( nullIfNotFound )
|
1388
|
+
return null;
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
array.push( newItem );
|
1392
|
+
return newItem;
|
1393
|
+
};
|
1394
|
+
|
1395
|
+
// Tool function used to remove an item from an array based on its id.
|
1396
|
+
var removeById = function( array, id, recurse )
|
1397
|
+
{
|
1398
|
+
for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
|
1399
|
+
{
|
1400
|
+
if ( item.id == id )
|
1401
|
+
return array.splice( i, 1 );
|
1402
|
+
if ( recurse && item[ recurse ] )
|
1403
|
+
{
|
1404
|
+
var retval = removeById( item[ recurse ], id, recurse );
|
1405
|
+
if ( retval )
|
1406
|
+
return retval;
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
return null;
|
1410
|
+
};
|
1411
|
+
|
1412
|
+
/**
|
1413
|
+
* This class is not really part of the API. It is the "definition" property value
|
1414
|
+
* passed to "dialogDefinition" event handlers.
|
1415
|
+
* @constructor
|
1416
|
+
* @name CKEDITOR.dialog.dialogDefinitionObject
|
1417
|
+
* @extends CKEDITOR.dialog.dialogDefinition
|
1418
|
+
* @example
|
1419
|
+
* CKEDITOR.on( 'dialogDefinition', function( evt )
|
1420
|
+
* {
|
1421
|
+
* var definition = evt.data.definition;
|
1422
|
+
* var content = definition.getContents( 'page1' );
|
1423
|
+
* ...
|
1424
|
+
* } );
|
1425
|
+
*/
|
1426
|
+
var definitionObject = function( dialog, dialogDefinition )
|
1427
|
+
{
|
1428
|
+
// TODO : Check if needed.
|
1429
|
+
this.dialog = dialog;
|
1430
|
+
|
1431
|
+
// Transform the contents entries in contentObjects.
|
1432
|
+
var contents = dialogDefinition.contents;
|
1433
|
+
for ( var i = 0, content ; ( content = contents[i] ) ; i++ )
|
1434
|
+
contents[ i ] = content && new contentObject( dialog, content );
|
1435
|
+
|
1436
|
+
CKEDITOR.tools.extend( this, dialogDefinition );
|
1437
|
+
};
|
1438
|
+
|
1439
|
+
definitionObject.prototype =
|
1440
|
+
/** @lends CKEDITOR.dialog.dialogDefinitionObject.prototype */
|
1441
|
+
{
|
1442
|
+
/**
|
1443
|
+
* Gets a content definition.
|
1444
|
+
* @param {String} id The id of the content definition.
|
1445
|
+
* @returns {CKEDITOR.dialog.contentDefinition} The content definition
|
1446
|
+
* matching id.
|
1447
|
+
*/
|
1448
|
+
getContents : function( id )
|
1449
|
+
{
|
1450
|
+
return getById( this.contents, id );
|
1451
|
+
},
|
1452
|
+
|
1453
|
+
/**
|
1454
|
+
* Gets a button definition.
|
1455
|
+
* @param {String} id The id of the button definition.
|
1456
|
+
* @returns {CKEDITOR.dialog.buttonDefinition} The button definition
|
1457
|
+
* matching id.
|
1458
|
+
*/
|
1459
|
+
getButton : function( id )
|
1460
|
+
{
|
1461
|
+
return getById( this.buttons, id );
|
1462
|
+
},
|
1463
|
+
|
1464
|
+
/**
|
1465
|
+
* Adds a content definition object under this dialog definition.
|
1466
|
+
* @param {CKEDITOR.dialog.contentDefinition} contentDefinition The
|
1467
|
+
* content definition.
|
1468
|
+
* @param {String} [nextSiblingId] The id of an existing content
|
1469
|
+
* definition which the new content definition will be inserted
|
1470
|
+
* before. Omit if the new content definition is to be inserted as
|
1471
|
+
* the last item.
|
1472
|
+
* @returns {CKEDITOR.dialog.contentDefinition} The inserted content
|
1473
|
+
* definition.
|
1474
|
+
*/
|
1475
|
+
addContents : function( contentDefinition, nextSiblingId )
|
1476
|
+
{
|
1477
|
+
return addById( this.contents, contentDefinition, nextSiblingId );
|
1478
|
+
},
|
1479
|
+
|
1480
|
+
/**
|
1481
|
+
* Adds a button definition object under this dialog definition.
|
1482
|
+
* @param {CKEDITOR.dialog.buttonDefinition} buttonDefinition The
|
1483
|
+
* button definition.
|
1484
|
+
* @param {String} [nextSiblingId] The id of an existing button
|
1485
|
+
* definition which the new button definition will be inserted
|
1486
|
+
* before. Omit if the new button definition is to be inserted as
|
1487
|
+
* the last item.
|
1488
|
+
* @returns {CKEDITOR.dialog.buttonDefinition} The inserted button
|
1489
|
+
* definition.
|
1490
|
+
*/
|
1491
|
+
addButton : function( buttonDefinition, nextSiblingId )
|
1492
|
+
{
|
1493
|
+
return addById( this.buttons, buttonDefinition, nextSiblingId );
|
1494
|
+
},
|
1495
|
+
|
1496
|
+
/**
|
1497
|
+
* Removes a content definition from this dialog definition.
|
1498
|
+
* @param {String} id The id of the content definition to be removed.
|
1499
|
+
* @returns {CKEDITOR.dialog.contentDefinition} The removed content
|
1500
|
+
* definition.
|
1501
|
+
*/
|
1502
|
+
removeContents : function( id )
|
1503
|
+
{
|
1504
|
+
removeById( this.contents, id );
|
1505
|
+
},
|
1506
|
+
|
1507
|
+
/**
|
1508
|
+
* Removes a button definition from the dialog definition.
|
1509
|
+
* @param {String} id The id of the button definition to be removed.
|
1510
|
+
* @returns {CKEDITOR.dialog.buttonDefinition} The removed button
|
1511
|
+
* definition.
|
1512
|
+
*/
|
1513
|
+
removeButton : function( id )
|
1514
|
+
{
|
1515
|
+
removeById( this.buttons, id );
|
1516
|
+
}
|
1517
|
+
};
|
1518
|
+
|
1519
|
+
/**
|
1520
|
+
* This class is not really part of the API. It is the template of the
|
1521
|
+
* objects representing content pages inside the
|
1522
|
+
* CKEDITOR.dialog.dialogDefinitionObject.
|
1523
|
+
* @constructor
|
1524
|
+
* @name CKEDITOR.dialog.contentDefinitionObject
|
1525
|
+
* @example
|
1526
|
+
* CKEDITOR.on( 'dialogDefinition', function( evt )
|
1527
|
+
* {
|
1528
|
+
* var definition = evt.data.definition;
|
1529
|
+
* var content = definition.getContents( 'page1' );
|
1530
|
+
* content.remove( 'textInput1' );
|
1531
|
+
* ...
|
1532
|
+
* } );
|
1533
|
+
*/
|
1534
|
+
function contentObject( dialog, contentDefinition )
|
1535
|
+
{
|
1536
|
+
this._ =
|
1537
|
+
{
|
1538
|
+
dialog : dialog
|
1539
|
+
};
|
1540
|
+
|
1541
|
+
CKEDITOR.tools.extend( this, contentDefinition );
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
contentObject.prototype =
|
1545
|
+
/** @lends CKEDITOR.dialog.contentDefinitionObject.prototype */
|
1546
|
+
{
|
1547
|
+
/**
|
1548
|
+
* Gets a UI element definition under the content definition.
|
1549
|
+
* @param {String} id The id of the UI element definition.
|
1550
|
+
* @returns {CKEDITOR.dialog.uiElementDefinition}
|
1551
|
+
*/
|
1552
|
+
get : function( id )
|
1553
|
+
{
|
1554
|
+
return getById( this.elements, id, 'children' );
|
1555
|
+
},
|
1556
|
+
|
1557
|
+
/**
|
1558
|
+
* Adds a UI element definition to the content definition.
|
1559
|
+
* @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition The
|
1560
|
+
* UI elemnet definition to be added.
|
1561
|
+
* @param {String} nextSiblingId The id of an existing UI element
|
1562
|
+
* definition which the new UI element definition will be inserted
|
1563
|
+
* before. Omit if the new button definition is to be inserted as
|
1564
|
+
* the last item.
|
1565
|
+
* @returns {CKEDITOR.dialog.uiElementDefinition} The element
|
1566
|
+
* definition inserted.
|
1567
|
+
*/
|
1568
|
+
add : function( elementDefinition, nextSiblingId )
|
1569
|
+
{
|
1570
|
+
return addById( this.elements, elementDefinition, nextSiblingId, 'children' );
|
1571
|
+
},
|
1572
|
+
|
1573
|
+
/**
|
1574
|
+
* Removes a UI element definition from the content definition.
|
1575
|
+
* @param {String} id The id of the UI element definition to be
|
1576
|
+
* removed.
|
1577
|
+
* @returns {CKEDITOR.dialog.uiElementDefinition} The element
|
1578
|
+
* definition removed.
|
1579
|
+
* @example
|
1580
|
+
*/
|
1581
|
+
remove : function( id )
|
1582
|
+
{
|
1583
|
+
removeById( this.elements, id, 'children' );
|
1584
|
+
}
|
1585
|
+
};
|
1586
|
+
|
1587
|
+
function initDragAndDrop( dialog )
|
1588
|
+
{
|
1589
|
+
var lastCoords = null,
|
1590
|
+
abstractDialogCoords = null,
|
1591
|
+
element = dialog.getElement().getFirst(),
|
1592
|
+
editor = dialog.getParentEditor(),
|
1593
|
+
magnetDistance = editor.config.dialog_magnetDistance,
|
1594
|
+
margins = editor.skin.margins || [ 0, 0, 0, 0 ];
|
1595
|
+
|
1596
|
+
if ( typeof magnetDistance == 'undefined' )
|
1597
|
+
magnetDistance = 20;
|
1598
|
+
|
1599
|
+
function mouseMoveHandler( evt )
|
1600
|
+
{
|
1601
|
+
var dialogSize = dialog.getSize(),
|
1602
|
+
viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
|
1603
|
+
x = evt.data.$.screenX,
|
1604
|
+
y = evt.data.$.screenY,
|
1605
|
+
dx = x - lastCoords.x,
|
1606
|
+
dy = y - lastCoords.y,
|
1607
|
+
realX, realY;
|
1608
|
+
|
1609
|
+
lastCoords = { x : x, y : y };
|
1610
|
+
abstractDialogCoords.x += dx;
|
1611
|
+
abstractDialogCoords.y += dy;
|
1612
|
+
|
1613
|
+
if ( abstractDialogCoords.x + margins[3] < magnetDistance )
|
1614
|
+
realX = - margins[3];
|
1615
|
+
else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
|
1616
|
+
realX = viewPaneSize.width - dialogSize.width + margins[1];
|
1617
|
+
else
|
1618
|
+
realX = abstractDialogCoords.x;
|
1619
|
+
|
1620
|
+
if ( abstractDialogCoords.y + margins[0] < magnetDistance )
|
1621
|
+
realY = - margins[0];
|
1622
|
+
else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
|
1623
|
+
realY = viewPaneSize.height - dialogSize.height + margins[2];
|
1624
|
+
else
|
1625
|
+
realY = abstractDialogCoords.y;
|
1626
|
+
|
1627
|
+
dialog.move( realX, realY );
|
1628
|
+
|
1629
|
+
evt.data.preventDefault();
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
function mouseUpHandler( evt )
|
1633
|
+
{
|
1634
|
+
CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
|
1635
|
+
CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
|
1636
|
+
|
1637
|
+
if ( CKEDITOR.env.ie6Compat )
|
1638
|
+
{
|
1639
|
+
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
|
1640
|
+
coverDoc.removeListener( 'mousemove', mouseMoveHandler );
|
1641
|
+
coverDoc.removeListener( 'mouseup', mouseUpHandler );
|
1642
|
+
}
|
1643
|
+
}
|
1644
|
+
|
1645
|
+
dialog.parts.title.on( 'mousedown', function( evt )
|
1646
|
+
{
|
1647
|
+
dialog._.updateSize = true;
|
1648
|
+
|
1649
|
+
lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
|
1650
|
+
|
1651
|
+
CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
|
1652
|
+
CKEDITOR.document.on( 'mouseup', mouseUpHandler );
|
1653
|
+
abstractDialogCoords = dialog.getPosition();
|
1654
|
+
|
1655
|
+
if ( CKEDITOR.env.ie6Compat )
|
1656
|
+
{
|
1657
|
+
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
|
1658
|
+
coverDoc.on( 'mousemove', mouseMoveHandler );
|
1659
|
+
coverDoc.on( 'mouseup', mouseUpHandler );
|
1660
|
+
}
|
1661
|
+
|
1662
|
+
evt.data.preventDefault();
|
1663
|
+
}, dialog );
|
1664
|
+
}
|
1665
|
+
|
1666
|
+
function initResizeHandles( dialog )
|
1667
|
+
{
|
1668
|
+
var definition = dialog.definition,
|
1669
|
+
minWidth = definition.minWidth || 0,
|
1670
|
+
minHeight = definition.minHeight || 0,
|
1671
|
+
resizable = definition.resizable,
|
1672
|
+
margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ];
|
1673
|
+
|
1674
|
+
function topSizer( coords, dy )
|
1675
|
+
{
|
1676
|
+
coords.y += dy;
|
1677
|
+
}
|
1678
|
+
|
1679
|
+
function rightSizer( coords, dx )
|
1680
|
+
{
|
1681
|
+
coords.x2 += dx;
|
1682
|
+
}
|
1683
|
+
|
1684
|
+
function bottomSizer( coords, dy )
|
1685
|
+
{
|
1686
|
+
coords.y2 += dy;
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
function leftSizer( coords, dx )
|
1690
|
+
{
|
1691
|
+
coords.x += dx;
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
var lastCoords = null,
|
1695
|
+
abstractDialogCoords = null,
|
1696
|
+
magnetDistance = dialog._.editor.config.magnetDistance,
|
1697
|
+
parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ];
|
1698
|
+
|
1699
|
+
function mouseDownHandler( evt )
|
1700
|
+
{
|
1701
|
+
var partName = evt.listenerData.part, size = dialog.getSize();
|
1702
|
+
abstractDialogCoords = dialog.getPosition();
|
1703
|
+
CKEDITOR.tools.extend( abstractDialogCoords,
|
1704
|
+
{
|
1705
|
+
x2 : abstractDialogCoords.x + size.width,
|
1706
|
+
y2 : abstractDialogCoords.y + size.height
|
1707
|
+
} );
|
1708
|
+
lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
|
1709
|
+
|
1710
|
+
CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
|
1711
|
+
CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
|
1712
|
+
|
1713
|
+
if ( CKEDITOR.env.ie6Compat )
|
1714
|
+
{
|
1715
|
+
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
|
1716
|
+
coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
|
1717
|
+
coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
|
1718
|
+
}
|
1719
|
+
|
1720
|
+
evt.data.preventDefault();
|
1721
|
+
}
|
1722
|
+
|
1723
|
+
function mouseMoveHandler( evt )
|
1724
|
+
{
|
1725
|
+
var x = evt.data.$.screenX,
|
1726
|
+
y = evt.data.$.screenY,
|
1727
|
+
dx = x - lastCoords.x,
|
1728
|
+
dy = y - lastCoords.y,
|
1729
|
+
viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
|
1730
|
+
partName = evt.listenerData.part;
|
1731
|
+
|
1732
|
+
if ( partName.search( 't' ) != -1 )
|
1733
|
+
topSizer( abstractDialogCoords, dy );
|
1734
|
+
if ( partName.search( 'l' ) != -1 )
|
1735
|
+
leftSizer( abstractDialogCoords, dx );
|
1736
|
+
if ( partName.search( 'b' ) != -1 )
|
1737
|
+
bottomSizer( abstractDialogCoords, dy );
|
1738
|
+
if ( partName.search( 'r' ) != -1 )
|
1739
|
+
rightSizer( abstractDialogCoords, dx );
|
1740
|
+
|
1741
|
+
lastCoords = { x : x, y : y };
|
1742
|
+
|
1743
|
+
var realX, realY, realX2, realY2;
|
1744
|
+
|
1745
|
+
if ( abstractDialogCoords.x + margins[3] < magnetDistance )
|
1746
|
+
realX = - margins[3];
|
1747
|
+
else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
|
1748
|
+
realX = abstractDialogCoords.x2 - minWidth;
|
1749
|
+
else
|
1750
|
+
realX = abstractDialogCoords.x;
|
1751
|
+
|
1752
|
+
if ( abstractDialogCoords.y + margins[0] < magnetDistance )
|
1753
|
+
realY = - margins[0];
|
1754
|
+
else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
|
1755
|
+
realY = abstractDialogCoords.y2 - minHeight;
|
1756
|
+
else
|
1757
|
+
realY = abstractDialogCoords.y;
|
1758
|
+
|
1759
|
+
if ( abstractDialogCoords.x2 - margins[1] > viewPaneSize.width - magnetDistance )
|
1760
|
+
realX2 = viewPaneSize.width + margins[1] ;
|
1761
|
+
else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
|
1762
|
+
realX2 = abstractDialogCoords.x + minWidth;
|
1763
|
+
else
|
1764
|
+
realX2 = abstractDialogCoords.x2;
|
1765
|
+
|
1766
|
+
if ( abstractDialogCoords.y2 - margins[2] > viewPaneSize.height - magnetDistance )
|
1767
|
+
realY2= viewPaneSize.height + margins[2] ;
|
1768
|
+
else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
|
1769
|
+
realY2 = abstractDialogCoords.y + minHeight;
|
1770
|
+
else
|
1771
|
+
realY2 = abstractDialogCoords.y2 ;
|
1772
|
+
|
1773
|
+
dialog.move( realX, realY );
|
1774
|
+
dialog.resize( realX2 - realX, realY2 - realY );
|
1775
|
+
|
1776
|
+
evt.data.preventDefault();
|
1777
|
+
}
|
1778
|
+
|
1779
|
+
function mouseUpHandler( evt )
|
1780
|
+
{
|
1781
|
+
CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
|
1782
|
+
CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
|
1783
|
+
|
1784
|
+
if ( CKEDITOR.env.ie6Compat )
|
1785
|
+
{
|
1786
|
+
var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
|
1787
|
+
coverDoc.removeListener( 'mouseup', mouseUpHandler );
|
1788
|
+
coverDoc.removeListener( 'mousemove', mouseMoveHandler );
|
1789
|
+
}
|
1790
|
+
}
|
1791
|
+
|
1792
|
+
// TODO : Simplify the resize logic, having just a single resize grip <div>.
|
1793
|
+
// var widthTest = /[lr]/,
|
1794
|
+
// heightTest = /[tb]/;
|
1795
|
+
// for ( var i = 0 ; i < parts.length ; i++ )
|
1796
|
+
// {
|
1797
|
+
// var element = dialog.parts[ parts[i] + '_resize' ];
|
1798
|
+
// if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE ||
|
1799
|
+
// resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) ||
|
1800
|
+
// resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) )
|
1801
|
+
// {
|
1802
|
+
// element.hide();
|
1803
|
+
// continue;
|
1804
|
+
// }
|
1805
|
+
// element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } );
|
1806
|
+
// }
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
var resizeCover;
|
1810
|
+
// Caching resuable covers and allowing only one cover
|
1811
|
+
// on screen.
|
1812
|
+
var covers = {},
|
1813
|
+
currentCover;
|
1814
|
+
|
1815
|
+
function showCover( editor )
|
1816
|
+
{
|
1817
|
+
var win = CKEDITOR.document.getWindow();
|
1818
|
+
var config = editor.config,
|
1819
|
+
backgroundColorStyle = config.dialog_backgroundCoverColor || 'white',
|
1820
|
+
backgroundCoverOpacity = config.dialog_backgroundCoverOpacity,
|
1821
|
+
baseFloatZIndex = config.baseFloatZIndex,
|
1822
|
+
coverKey = CKEDITOR.tools.genKey(
|
1823
|
+
backgroundColorStyle,
|
1824
|
+
backgroundCoverOpacity,
|
1825
|
+
baseFloatZIndex ),
|
1826
|
+
coverElement = covers[ coverKey ];
|
1827
|
+
|
1828
|
+
if ( !coverElement )
|
1829
|
+
{
|
1830
|
+
var html = [
|
1831
|
+
'<div style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ),
|
1832
|
+
'; z-index: ', baseFloatZIndex,
|
1833
|
+
'; top: 0px; left: 0px; ',
|
1834
|
+
( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ),
|
1835
|
+
'" class="cke_dialog_background_cover">'
|
1836
|
+
];
|
1837
|
+
|
1838
|
+
if ( CKEDITOR.env.ie6Compat )
|
1839
|
+
{
|
1840
|
+
// Support for custom document.domain in IE.
|
1841
|
+
var isCustomDomain = CKEDITOR.env.isCustomDomain(),
|
1842
|
+
iframeHtml = '<html><body style=\\\'background-color:' + backgroundColorStyle + ';\\\'></body></html>';
|
1843
|
+
|
1844
|
+
html.push(
|
1845
|
+
'<iframe' +
|
1846
|
+
' hidefocus="true"' +
|
1847
|
+
' frameborder="0"' +
|
1848
|
+
' id="cke_dialog_background_iframe"' +
|
1849
|
+
' src="javascript:' );
|
1850
|
+
|
1851
|
+
html.push( 'void((function(){' +
|
1852
|
+
'document.open();' +
|
1853
|
+
( isCustomDomain ? 'document.domain=\'' + document.domain + '\';' : '' ) +
|
1854
|
+
'document.write( \'' + iframeHtml + '\' );' +
|
1855
|
+
'document.close();' +
|
1856
|
+
'})())' );
|
1857
|
+
|
1858
|
+
html.push(
|
1859
|
+
'"' +
|
1860
|
+
' style="' +
|
1861
|
+
'position:absolute;' +
|
1862
|
+
'left:0;' +
|
1863
|
+
'top:0;' +
|
1864
|
+
'width:100%;' +
|
1865
|
+
'height: 100%;' +
|
1866
|
+
'progid:DXImageTransform.Microsoft.Alpha(opacity=0)">' +
|
1867
|
+
'</iframe>' );
|
1868
|
+
}
|
1869
|
+
|
1870
|
+
html.push( '</div>' );
|
1871
|
+
|
1872
|
+
coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) );
|
1873
|
+
coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 );
|
1874
|
+
|
1875
|
+
coverElement.appendTo( CKEDITOR.document.getBody() );
|
1876
|
+
covers[ coverKey ] = coverElement;
|
1877
|
+
}
|
1878
|
+
else
|
1879
|
+
coverElement. show();
|
1880
|
+
|
1881
|
+
currentCover = coverElement;
|
1882
|
+
var resizeFunc = function()
|
1883
|
+
{
|
1884
|
+
var size = win.getViewPaneSize();
|
1885
|
+
coverElement.setStyles(
|
1886
|
+
{
|
1887
|
+
width : size.width + 'px',
|
1888
|
+
height : size.height + 'px'
|
1889
|
+
} );
|
1890
|
+
};
|
1891
|
+
|
1892
|
+
var scrollFunc = function()
|
1893
|
+
{
|
1894
|
+
var pos = win.getScrollPosition(),
|
1895
|
+
cursor = CKEDITOR.dialog._.currentTop;
|
1896
|
+
coverElement.setStyles(
|
1897
|
+
{
|
1898
|
+
left : pos.x + 'px',
|
1899
|
+
top : pos.y + 'px'
|
1900
|
+
});
|
1901
|
+
|
1902
|
+
do
|
1903
|
+
{
|
1904
|
+
var dialogPos = cursor.getPosition();
|
1905
|
+
cursor.move( dialogPos.x, dialogPos.y );
|
1906
|
+
} while ( ( cursor = cursor._.parentDialog ) );
|
1907
|
+
};
|
1908
|
+
|
1909
|
+
resizeCover = resizeFunc;
|
1910
|
+
win.on( 'resize', resizeFunc );
|
1911
|
+
resizeFunc();
|
1912
|
+
if ( CKEDITOR.env.ie6Compat )
|
1913
|
+
{
|
1914
|
+
// IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll.
|
1915
|
+
// So we need to invent a really funny way to make it work.
|
1916
|
+
var myScrollHandler = function()
|
1917
|
+
{
|
1918
|
+
scrollFunc();
|
1919
|
+
arguments.callee.prevScrollHandler.apply( this, arguments );
|
1920
|
+
};
|
1921
|
+
win.$.setTimeout( function()
|
1922
|
+
{
|
1923
|
+
myScrollHandler.prevScrollHandler = window.onscroll || function(){};
|
1924
|
+
window.onscroll = myScrollHandler;
|
1925
|
+
}, 0 );
|
1926
|
+
scrollFunc();
|
1927
|
+
}
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
function hideCover()
|
1931
|
+
{
|
1932
|
+
if ( !currentCover )
|
1933
|
+
return;
|
1934
|
+
|
1935
|
+
var win = CKEDITOR.document.getWindow();
|
1936
|
+
currentCover.hide();
|
1937
|
+
win.removeListener( 'resize', resizeCover );
|
1938
|
+
|
1939
|
+
if ( CKEDITOR.env.ie6Compat )
|
1940
|
+
{
|
1941
|
+
win.$.setTimeout( function()
|
1942
|
+
{
|
1943
|
+
var prevScrollHandler = window.onscroll && window.onscroll.prevScrollHandler;
|
1944
|
+
window.onscroll = prevScrollHandler || null;
|
1945
|
+
}, 0 );
|
1946
|
+
}
|
1947
|
+
resizeCover = null;
|
1948
|
+
}
|
1949
|
+
|
1950
|
+
function removeCovers()
|
1951
|
+
{
|
1952
|
+
for ( var coverId in covers )
|
1953
|
+
covers[ coverId ].remove();
|
1954
|
+
covers = {};
|
1955
|
+
}
|
1956
|
+
|
1957
|
+
var accessKeyProcessors = {};
|
1958
|
+
|
1959
|
+
var accessKeyDownHandler = function( evt )
|
1960
|
+
{
|
1961
|
+
var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey,
|
1962
|
+
alt = evt.data.$.altKey,
|
1963
|
+
shift = evt.data.$.shiftKey,
|
1964
|
+
key = String.fromCharCode( evt.data.$.keyCode ),
|
1965
|
+
keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key];
|
1966
|
+
|
1967
|
+
if ( !keyProcessor || !keyProcessor.length )
|
1968
|
+
return;
|
1969
|
+
|
1970
|
+
keyProcessor = keyProcessor[keyProcessor.length - 1];
|
1971
|
+
keyProcessor.keydown && keyProcessor.keydown.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
|
1972
|
+
evt.data.preventDefault();
|
1973
|
+
};
|
1974
|
+
|
1975
|
+
var accessKeyUpHandler = function( evt )
|
1976
|
+
{
|
1977
|
+
var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey,
|
1978
|
+
alt = evt.data.$.altKey,
|
1979
|
+
shift = evt.data.$.shiftKey,
|
1980
|
+
key = String.fromCharCode( evt.data.$.keyCode ),
|
1981
|
+
keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key];
|
1982
|
+
|
1983
|
+
if ( !keyProcessor || !keyProcessor.length )
|
1984
|
+
return;
|
1985
|
+
|
1986
|
+
keyProcessor = keyProcessor[keyProcessor.length - 1];
|
1987
|
+
if ( keyProcessor.keyup )
|
1988
|
+
{
|
1989
|
+
keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
|
1990
|
+
evt.data.preventDefault();
|
1991
|
+
}
|
1992
|
+
};
|
1993
|
+
|
1994
|
+
var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc )
|
1995
|
+
{
|
1996
|
+
var procList = accessKeyProcessors[key] || ( accessKeyProcessors[key] = [] );
|
1997
|
+
procList.push( {
|
1998
|
+
uiElement : uiElement,
|
1999
|
+
dialog : dialog,
|
2000
|
+
key : key,
|
2001
|
+
keyup : upFunc || uiElement.accessKeyUp,
|
2002
|
+
keydown : downFunc || uiElement.accessKeyDown
|
2003
|
+
} );
|
2004
|
+
};
|
2005
|
+
|
2006
|
+
var unregisterAccessKey = function( obj )
|
2007
|
+
{
|
2008
|
+
for ( var i in accessKeyProcessors )
|
2009
|
+
{
|
2010
|
+
var list = accessKeyProcessors[i];
|
2011
|
+
for ( var j = list.length - 1 ; j >= 0 ; j-- )
|
2012
|
+
{
|
2013
|
+
if ( list[j].dialog == obj || list[j].uiElement == obj )
|
2014
|
+
list.splice( j, 1 );
|
2015
|
+
}
|
2016
|
+
if ( list.length === 0 )
|
2017
|
+
delete accessKeyProcessors[i];
|
2018
|
+
}
|
2019
|
+
};
|
2020
|
+
|
2021
|
+
var tabAccessKeyUp = function( dialog, key )
|
2022
|
+
{
|
2023
|
+
if ( dialog._.accessKeyMap[key] )
|
2024
|
+
dialog.selectPage( dialog._.accessKeyMap[key] );
|
2025
|
+
};
|
2026
|
+
|
2027
|
+
var tabAccessKeyDown = function( dialog, key )
|
2028
|
+
{
|
2029
|
+
};
|
2030
|
+
|
2031
|
+
// ESC, ENTER
|
2032
|
+
var preventKeyBubblingKeys = { 27 :1, 13 :1 };
|
2033
|
+
var preventKeyBubbling = function( e )
|
2034
|
+
{
|
2035
|
+
if ( e.data.getKeystroke() in preventKeyBubblingKeys )
|
2036
|
+
e.data.stopPropagation();
|
2037
|
+
};
|
2038
|
+
|
2039
|
+
(function()
|
2040
|
+
{
|
2041
|
+
CKEDITOR.ui.dialog =
|
2042
|
+
{
|
2043
|
+
/**
|
2044
|
+
* The base class of all dialog UI elements.
|
2045
|
+
* @constructor
|
2046
|
+
* @param {CKEDITOR.dialog} dialog Parent dialog object.
|
2047
|
+
* @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition Element
|
2048
|
+
* definition. Accepted fields:
|
2049
|
+
* <ul>
|
2050
|
+
* <li><strong>id</strong> (Required) The id of the UI element. See {@link
|
2051
|
+
* CKEDITOR.dialog#getContentElement}</li>
|
2052
|
+
* <li><strong>type</strong> (Required) The type of the UI element. The
|
2053
|
+
* value to this field specifies which UI element class will be used to
|
2054
|
+
* generate the final widget.</li>
|
2055
|
+
* <li><strong>title</strong> (Optional) The popup tooltip for the UI
|
2056
|
+
* element.</li>
|
2057
|
+
* <li><strong>hidden</strong> (Optional) A flag that tells if the element
|
2058
|
+
* should be initially visible.</li>
|
2059
|
+
* <li><strong>className</strong> (Optional) Additional CSS class names
|
2060
|
+
* to add to the UI element. Separated by space.</li>
|
2061
|
+
* <li><strong>style</strong> (Optional) Additional CSS inline styles
|
2062
|
+
* to add to the UI element. A semicolon (;) is required after the last
|
2063
|
+
* style declaration.</li>
|
2064
|
+
* <li><strong>accessKey</strong> (Optional) The alphanumeric access key
|
2065
|
+
* for this element. Access keys are automatically prefixed by CTRL.</li>
|
2066
|
+
* <li><strong>on*</strong> (Optional) Any UI element definition field that
|
2067
|
+
* starts with <em>on</em> followed immediately by a capital letter and
|
2068
|
+
* probably more letters is an event handler. Event handlers may be further
|
2069
|
+
* divided into registered event handlers and DOM event handlers. Please
|
2070
|
+
* refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and
|
2071
|
+
* {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more
|
2072
|
+
* information.</li>
|
2073
|
+
* </ul>
|
2074
|
+
* @param {Array} htmlList
|
2075
|
+
* List of HTML code to be added to the dialog's content area.
|
2076
|
+
* @param {Function|String} nodeNameArg
|
2077
|
+
* A function returning a string, or a simple string for the node name for
|
2078
|
+
* the root DOM node. Default is 'div'.
|
2079
|
+
* @param {Function|Object} stylesArg
|
2080
|
+
* A function returning an object, or a simple object for CSS styles applied
|
2081
|
+
* to the DOM node. Default is empty object.
|
2082
|
+
* @param {Function|Object} attributesArg
|
2083
|
+
* A fucntion returning an object, or a simple object for attributes applied
|
2084
|
+
* to the DOM node. Default is empty object.
|
2085
|
+
* @param {Function|String} contentsArg
|
2086
|
+
* A function returning a string, or a simple string for the HTML code inside
|
2087
|
+
* the root DOM node. Default is empty string.
|
2088
|
+
* @example
|
2089
|
+
*/
|
2090
|
+
uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg )
|
2091
|
+
{
|
2092
|
+
if ( arguments.length < 4 )
|
2093
|
+
return;
|
2094
|
+
|
2095
|
+
var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div',
|
2096
|
+
html = [ '<', nodeName, ' ' ],
|
2097
|
+
styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {},
|
2098
|
+
attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {},
|
2099
|
+
innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '',
|
2100
|
+
domId = this.domId = attributes.id || CKEDITOR.tools.getNextId() + '_uiElement',
|
2101
|
+
id = this.id = elementDefinition.id,
|
2102
|
+
i;
|
2103
|
+
|
2104
|
+
// Set the id, a unique id is required for getElement() to work.
|
2105
|
+
attributes.id = domId;
|
2106
|
+
|
2107
|
+
// Set the type and definition CSS class names.
|
2108
|
+
var classes = {};
|
2109
|
+
if ( elementDefinition.type )
|
2110
|
+
classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1;
|
2111
|
+
if ( elementDefinition.className )
|
2112
|
+
classes[ elementDefinition.className ] = 1;
|
2113
|
+
var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : [];
|
2114
|
+
for ( i = 0 ; i < attributeClasses.length ; i++ )
|
2115
|
+
{
|
2116
|
+
if ( attributeClasses[i] )
|
2117
|
+
classes[ attributeClasses[i] ] = 1;
|
2118
|
+
}
|
2119
|
+
var finalClasses = [];
|
2120
|
+
for ( i in classes )
|
2121
|
+
finalClasses.push( i );
|
2122
|
+
attributes['class'] = finalClasses.join( ' ' );
|
2123
|
+
|
2124
|
+
// Set the popup tooltop.
|
2125
|
+
if ( elementDefinition.title )
|
2126
|
+
attributes.title = elementDefinition.title;
|
2127
|
+
|
2128
|
+
// Write the inline CSS styles.
|
2129
|
+
var styleStr = ( elementDefinition.style || '' ).split( ';' );
|
2130
|
+
for ( i in styles )
|
2131
|
+
styleStr.push( i + ':' + styles[i] );
|
2132
|
+
if ( elementDefinition.hidden )
|
2133
|
+
styleStr.push( 'display:none' );
|
2134
|
+
for ( i = styleStr.length - 1 ; i >= 0 ; i-- )
|
2135
|
+
{
|
2136
|
+
if ( styleStr[i] === '' )
|
2137
|
+
styleStr.splice( i, 1 );
|
2138
|
+
}
|
2139
|
+
if ( styleStr.length > 0 )
|
2140
|
+
attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' );
|
2141
|
+
|
2142
|
+
// Write the attributes.
|
2143
|
+
for ( i in attributes )
|
2144
|
+
html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ');
|
2145
|
+
|
2146
|
+
// Write the content HTML.
|
2147
|
+
html.push( '>', innerHTML, '</', nodeName, '>' );
|
2148
|
+
|
2149
|
+
// Add contents to the parent HTML array.
|
2150
|
+
htmlList.push( html.join( '' ) );
|
2151
|
+
|
2152
|
+
( this._ || ( this._ = {} ) ).dialog = dialog;
|
2153
|
+
|
2154
|
+
// Override isChanged if it is defined in element definition.
|
2155
|
+
if ( typeof( elementDefinition.isChanged ) == 'boolean' )
|
2156
|
+
this.isChanged = function(){ return elementDefinition.isChanged; };
|
2157
|
+
if ( typeof( elementDefinition.isChanged ) == 'function' )
|
2158
|
+
this.isChanged = elementDefinition.isChanged;
|
2159
|
+
|
2160
|
+
// Add events.
|
2161
|
+
CKEDITOR.event.implementOn( this );
|
2162
|
+
|
2163
|
+
this.registerEvents( elementDefinition );
|
2164
|
+
if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey )
|
2165
|
+
registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey );
|
2166
|
+
|
2167
|
+
var me = this;
|
2168
|
+
dialog.on( 'load', function()
|
2169
|
+
{
|
2170
|
+
if ( me.getInputElement() )
|
2171
|
+
{
|
2172
|
+
me.getInputElement().on( 'focus', function()
|
2173
|
+
{
|
2174
|
+
dialog._.tabBarMode = false;
|
2175
|
+
dialog._.hasFocus = true;
|
2176
|
+
me.fire( 'focus' );
|
2177
|
+
}, me );
|
2178
|
+
}
|
2179
|
+
} );
|
2180
|
+
|
2181
|
+
// Register the object as a tab focus if it can be included.
|
2182
|
+
if ( this.keyboardFocusable )
|
2183
|
+
{
|
2184
|
+
this.tabIndex = elementDefinition.tabIndex || 0;
|
2185
|
+
|
2186
|
+
this.focusIndex = dialog._.focusList.push( this ) - 1;
|
2187
|
+
this.on( 'focus', function()
|
2188
|
+
{
|
2189
|
+
dialog._.currentFocusIndex = me.focusIndex;
|
2190
|
+
} );
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
// Completes this object with everything we have in the
|
2194
|
+
// definition.
|
2195
|
+
CKEDITOR.tools.extend( this, elementDefinition );
|
2196
|
+
},
|
2197
|
+
|
2198
|
+
/**
|
2199
|
+
* Horizontal layout box for dialog UI elements, auto-expends to available width of container.
|
2200
|
+
* @constructor
|
2201
|
+
* @extends CKEDITOR.ui.dialog.uiElement
|
2202
|
+
* @param {CKEDITOR.dialog} dialog
|
2203
|
+
* Parent dialog object.
|
2204
|
+
* @param {Array} childObjList
|
2205
|
+
* Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
|
2206
|
+
* container.
|
2207
|
+
* @param {Array} childHtmlList
|
2208
|
+
* Array of HTML code that correspond to the HTML output of all the
|
2209
|
+
* objects in childObjList.
|
2210
|
+
* @param {Array} htmlList
|
2211
|
+
* Array of HTML code that this element will output to.
|
2212
|
+
* @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
|
2213
|
+
* The element definition. Accepted fields:
|
2214
|
+
* <ul>
|
2215
|
+
* <li><strong>widths</strong> (Optional) The widths of child cells.</li>
|
2216
|
+
* <li><strong>height</strong> (Optional) The height of the layout.</li>
|
2217
|
+
* <li><strong>padding</strong> (Optional) The padding width inside child
|
2218
|
+
* cells.</li>
|
2219
|
+
* <li><strong>align</strong> (Optional) The alignment of the whole layout
|
2220
|
+
* </li>
|
2221
|
+
* </ul>
|
2222
|
+
* @example
|
2223
|
+
*/
|
2224
|
+
hbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
|
2225
|
+
{
|
2226
|
+
if ( arguments.length < 4 )
|
2227
|
+
return;
|
2228
|
+
|
2229
|
+
this._ || ( this._ = {} );
|
2230
|
+
|
2231
|
+
var children = this._.children = childObjList,
|
2232
|
+
widths = elementDefinition && elementDefinition.widths || null,
|
2233
|
+
height = elementDefinition && elementDefinition.height || null,
|
2234
|
+
styles = {},
|
2235
|
+
i;
|
2236
|
+
/** @ignore */
|
2237
|
+
var innerHTML = function()
|
2238
|
+
{
|
2239
|
+
var html = [ '<tbody><tr class="cke_dialog_ui_hbox">' ];
|
2240
|
+
for ( i = 0 ; i < childHtmlList.length ; i++ )
|
2241
|
+
{
|
2242
|
+
var className = 'cke_dialog_ui_hbox_child',
|
2243
|
+
styles = [];
|
2244
|
+
if ( i === 0 )
|
2245
|
+
className = 'cke_dialog_ui_hbox_first';
|
2246
|
+
if ( i == childHtmlList.length - 1 )
|
2247
|
+
className = 'cke_dialog_ui_hbox_last';
|
2248
|
+
html.push( '<td class="', className, '" role="presentation" ' );
|
2249
|
+
if ( widths )
|
2250
|
+
{
|
2251
|
+
if ( widths[i] )
|
2252
|
+
styles.push( 'width:' + cssLength( widths[i] ) );
|
2253
|
+
}
|
2254
|
+
else
|
2255
|
+
styles.push( 'width:' + Math.floor( 100 / childHtmlList.length ) + '%' );
|
2256
|
+
if ( height )
|
2257
|
+
styles.push( 'height:' + cssLength( height ) );
|
2258
|
+
if ( elementDefinition && elementDefinition.padding != undefined )
|
2259
|
+
styles.push( 'padding:' + cssLength( elementDefinition.padding ) );
|
2260
|
+
if ( styles.length > 0 )
|
2261
|
+
html.push( 'style="' + styles.join('; ') + '" ' );
|
2262
|
+
html.push( '>', childHtmlList[i], '</td>' );
|
2263
|
+
}
|
2264
|
+
html.push( '</tr></tbody>' );
|
2265
|
+
return html.join( '' );
|
2266
|
+
};
|
2267
|
+
|
2268
|
+
var attribs = { role : 'presentation' };
|
2269
|
+
elementDefinition && elementDefinition.align && ( attribs.align = elementDefinition.align );
|
2270
|
+
|
2271
|
+
CKEDITOR.ui.dialog.uiElement.call(
|
2272
|
+
this,
|
2273
|
+
dialog,
|
2274
|
+
elementDefinition || { type : 'hbox' },
|
2275
|
+
htmlList,
|
2276
|
+
'table',
|
2277
|
+
styles,
|
2278
|
+
attribs,
|
2279
|
+
innerHTML );
|
2280
|
+
},
|
2281
|
+
|
2282
|
+
/**
|
2283
|
+
* Vertical layout box for dialog UI elements.
|
2284
|
+
* @constructor
|
2285
|
+
* @extends CKEDITOR.ui.dialog.hbox
|
2286
|
+
* @param {CKEDITOR.dialog} dialog
|
2287
|
+
* Parent dialog object.
|
2288
|
+
* @param {Array} childObjList
|
2289
|
+
* Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
|
2290
|
+
* container.
|
2291
|
+
* @param {Array} childHtmlList
|
2292
|
+
* Array of HTML code that correspond to the HTML output of all the
|
2293
|
+
* objects in childObjList.
|
2294
|
+
* @param {Array} htmlList
|
2295
|
+
* Array of HTML code that this element will output to.
|
2296
|
+
* @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
|
2297
|
+
* The element definition. Accepted fields:
|
2298
|
+
* <ul>
|
2299
|
+
* <li><strong>width</strong> (Optional) The width of the layout.</li>
|
2300
|
+
* <li><strong>heights</strong> (Optional) The heights of individual cells.
|
2301
|
+
* </li>
|
2302
|
+
* <li><strong>align</strong> (Optional) The alignment of the layout.</li>
|
2303
|
+
* <li><strong>padding</strong> (Optional) The padding width inside child
|
2304
|
+
* cells.</li>
|
2305
|
+
* <li><strong>expand</strong> (Optional) Whether the layout should expand
|
2306
|
+
* vertically to fill its container.</li>
|
2307
|
+
* </ul>
|
2308
|
+
* @example
|
2309
|
+
*/
|
2310
|
+
vbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
|
2311
|
+
{
|
2312
|
+
if ( arguments.length < 3 )
|
2313
|
+
return;
|
2314
|
+
|
2315
|
+
this._ || ( this._ = {} );
|
2316
|
+
|
2317
|
+
var children = this._.children = childObjList,
|
2318
|
+
width = elementDefinition && elementDefinition.width || null,
|
2319
|
+
heights = elementDefinition && elementDefinition.heights || null;
|
2320
|
+
/** @ignore */
|
2321
|
+
var innerHTML = function()
|
2322
|
+
{
|
2323
|
+
var html = [ '<table role="presentation" cellspacing="0" border="0" ' ];
|
2324
|
+
html.push( 'style="' );
|
2325
|
+
if ( elementDefinition && elementDefinition.expand )
|
2326
|
+
html.push( 'height:100%;' );
|
2327
|
+
html.push( 'width:' + cssLength( width || '100%' ), ';' );
|
2328
|
+
html.push( '"' );
|
2329
|
+
html.push( 'align="', CKEDITOR.tools.htmlEncode(
|
2330
|
+
( elementDefinition && elementDefinition.align ) || ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' ) ), '" ' );
|
2331
|
+
|
2332
|
+
html.push( '><tbody>' );
|
2333
|
+
for ( var i = 0 ; i < childHtmlList.length ; i++ )
|
2334
|
+
{
|
2335
|
+
var styles = [];
|
2336
|
+
html.push( '<tr><td role="presentation" ' );
|
2337
|
+
if ( width )
|
2338
|
+
styles.push( 'width:' + cssLength( width || '100%' ) );
|
2339
|
+
if ( heights )
|
2340
|
+
styles.push( 'height:' + cssLength( heights[i] ) );
|
2341
|
+
else if ( elementDefinition && elementDefinition.expand )
|
2342
|
+
styles.push( 'height:' + Math.floor( 100 / childHtmlList.length ) + '%' );
|
2343
|
+
if ( elementDefinition && elementDefinition.padding != undefined )
|
2344
|
+
styles.push( 'padding:' + cssLength( elementDefinition.padding ) );
|
2345
|
+
if ( styles.length > 0 )
|
2346
|
+
html.push( 'style="', styles.join( '; ' ), '" ' );
|
2347
|
+
html.push( ' class="cke_dialog_ui_vbox_child">', childHtmlList[i], '</td></tr>' );
|
2348
|
+
}
|
2349
|
+
html.push( '</tbody></table>' );
|
2350
|
+
return html.join( '' );
|
2351
|
+
};
|
2352
|
+
CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML );
|
2353
|
+
}
|
2354
|
+
};
|
2355
|
+
})();
|
2356
|
+
|
2357
|
+
CKEDITOR.ui.dialog.uiElement.prototype =
|
2358
|
+
{
|
2359
|
+
/**
|
2360
|
+
* Gets the root DOM element of this dialog UI object.
|
2361
|
+
* @returns {CKEDITOR.dom.element} Root DOM element of UI object.
|
2362
|
+
* @example
|
2363
|
+
* uiElement.getElement().hide();
|
2364
|
+
*/
|
2365
|
+
getElement : function()
|
2366
|
+
{
|
2367
|
+
return CKEDITOR.document.getById( this.domId );
|
2368
|
+
},
|
2369
|
+
|
2370
|
+
/**
|
2371
|
+
* Gets the DOM element that the user inputs values.
|
2372
|
+
* This function is used by setValue(), getValue() and focus(). It should
|
2373
|
+
* be overrided in child classes where the input element isn't the root
|
2374
|
+
* element.
|
2375
|
+
* @returns {CKEDITOR.dom.element} The element where the user input values.
|
2376
|
+
* @example
|
2377
|
+
* var rawValue = textInput.getInputElement().$.value;
|
2378
|
+
*/
|
2379
|
+
getInputElement : function()
|
2380
|
+
{
|
2381
|
+
return this.getElement();
|
2382
|
+
},
|
2383
|
+
|
2384
|
+
/**
|
2385
|
+
* Gets the parent dialog object containing this UI element.
|
2386
|
+
* @returns {CKEDITOR.dialog} Parent dialog object.
|
2387
|
+
* @example
|
2388
|
+
* var dialog = uiElement.getDialog();
|
2389
|
+
*/
|
2390
|
+
getDialog : function()
|
2391
|
+
{
|
2392
|
+
return this._.dialog;
|
2393
|
+
},
|
2394
|
+
|
2395
|
+
/**
|
2396
|
+
* Sets the value of this dialog UI object.
|
2397
|
+
* @param {Object} value The new value.
|
2398
|
+
* @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
|
2399
|
+
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
|
2400
|
+
* @example
|
2401
|
+
* uiElement.setValue( 'Dingo' );
|
2402
|
+
*/
|
2403
|
+
setValue : function( value, noChangeEvent )
|
2404
|
+
{
|
2405
|
+
this.getInputElement().setValue( value );
|
2406
|
+
!noChangeEvent && this.fire( 'change', { value : value } );
|
2407
|
+
return this;
|
2408
|
+
},
|
2409
|
+
|
2410
|
+
/**
|
2411
|
+
* Gets the current value of this dialog UI object.
|
2412
|
+
* @returns {Object} The current value.
|
2413
|
+
* @example
|
2414
|
+
* var myValue = uiElement.getValue();
|
2415
|
+
*/
|
2416
|
+
getValue : function()
|
2417
|
+
{
|
2418
|
+
return this.getInputElement().getValue();
|
2419
|
+
},
|
2420
|
+
|
2421
|
+
/**
|
2422
|
+
* Tells whether the UI object's value has changed.
|
2423
|
+
* @returns {Boolean} true if changed, false if not changed.
|
2424
|
+
* @example
|
2425
|
+
* if ( uiElement.isChanged() )
|
2426
|
+
* confirm( 'Value changed! Continue?' );
|
2427
|
+
*/
|
2428
|
+
isChanged : function()
|
2429
|
+
{
|
2430
|
+
// Override in input classes.
|
2431
|
+
return false;
|
2432
|
+
},
|
2433
|
+
|
2434
|
+
/**
|
2435
|
+
* Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.
|
2436
|
+
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
|
2437
|
+
* @example
|
2438
|
+
* focus : function()
|
2439
|
+
* {
|
2440
|
+
* this.selectParentTab();
|
2441
|
+
* // do something else.
|
2442
|
+
* }
|
2443
|
+
*/
|
2444
|
+
selectParentTab : function()
|
2445
|
+
{
|
2446
|
+
var element = this.getInputElement(),
|
2447
|
+
cursor = element,
|
2448
|
+
tabId;
|
2449
|
+
while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 )
|
2450
|
+
{ /*jsl:pass*/ }
|
2451
|
+
|
2452
|
+
// Some widgets don't have parent tabs (e.g. OK and Cancel buttons).
|
2453
|
+
if ( !cursor )
|
2454
|
+
return this;
|
2455
|
+
|
2456
|
+
tabId = cursor.getAttribute( 'name' );
|
2457
|
+
// Avoid duplicate select.
|
2458
|
+
if ( this._.dialog._.currentTabId != tabId )
|
2459
|
+
this._.dialog.selectPage( tabId );
|
2460
|
+
return this;
|
2461
|
+
},
|
2462
|
+
|
2463
|
+
/**
|
2464
|
+
* Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.
|
2465
|
+
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
|
2466
|
+
* @example
|
2467
|
+
* uiElement.focus();
|
2468
|
+
*/
|
2469
|
+
focus : function()
|
2470
|
+
{
|
2471
|
+
this.selectParentTab().getInputElement().focus();
|
2472
|
+
return this;
|
2473
|
+
},
|
2474
|
+
|
2475
|
+
/**
|
2476
|
+
* Registers the on* event handlers defined in the element definition.
|
2477
|
+
* The default behavior of this function is:
|
2478
|
+
* <ol>
|
2479
|
+
* <li>
|
2480
|
+
* If the on* event is defined in the class's eventProcesors list,
|
2481
|
+
* then the registration is delegated to the corresponding function
|
2482
|
+
* in the eventProcessors list.
|
2483
|
+
* </li>
|
2484
|
+
* <li>
|
2485
|
+
* If the on* event is not defined in the eventProcessors list, then
|
2486
|
+
* register the event handler under the corresponding DOM event of
|
2487
|
+
* the UI element's input DOM element (as defined by the return value
|
2488
|
+
* of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}).
|
2489
|
+
* </li>
|
2490
|
+
* </ol>
|
2491
|
+
* This function is only called at UI element instantiation, but can
|
2492
|
+
* be overridded in child classes if they require more flexibility.
|
2493
|
+
* @param {CKEDITOR.dialog.uiElementDefinition} definition The UI element
|
2494
|
+
* definition.
|
2495
|
+
* @returns {CKEDITOR.dialog.uiElement} The current UI element.
|
2496
|
+
* @example
|
2497
|
+
*/
|
2498
|
+
registerEvents : function( definition )
|
2499
|
+
{
|
2500
|
+
var regex = /^on([A-Z]\w+)/,
|
2501
|
+
match;
|
2502
|
+
|
2503
|
+
var registerDomEvent = function( uiElement, dialog, eventName, func )
|
2504
|
+
{
|
2505
|
+
dialog.on( 'load', function()
|
2506
|
+
{
|
2507
|
+
uiElement.getInputElement().on( eventName, func, uiElement );
|
2508
|
+
});
|
2509
|
+
};
|
2510
|
+
|
2511
|
+
for ( var i in definition )
|
2512
|
+
{
|
2513
|
+
if ( !( match = i.match( regex ) ) )
|
2514
|
+
continue;
|
2515
|
+
if ( this.eventProcessors[i] )
|
2516
|
+
this.eventProcessors[i].call( this, this._.dialog, definition[i] );
|
2517
|
+
else
|
2518
|
+
registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
|
2519
|
+
}
|
2520
|
+
|
2521
|
+
return this;
|
2522
|
+
},
|
2523
|
+
|
2524
|
+
/**
|
2525
|
+
* The event processor list used by
|
2526
|
+
* {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element
|
2527
|
+
* instantiation. The default list defines three on* events:
|
2528
|
+
* <ol>
|
2529
|
+
* <li>onLoad - Called when the element's parent dialog opens for the
|
2530
|
+
* first time</li>
|
2531
|
+
* <li>onShow - Called whenever the element's parent dialog opens.</li>
|
2532
|
+
* <li>onHide - Called whenever the element's parent dialog closes.</li>
|
2533
|
+
* </ol>
|
2534
|
+
* @field
|
2535
|
+
* @type Object
|
2536
|
+
* @example
|
2537
|
+
* // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick
|
2538
|
+
* // handlers in the UI element's definitions.
|
2539
|
+
* CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {},
|
2540
|
+
* CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
|
2541
|
+
* { onClick : function( dialog, func ) { this.on( 'click', func ); } },
|
2542
|
+
* true );
|
2543
|
+
*/
|
2544
|
+
eventProcessors :
|
2545
|
+
{
|
2546
|
+
onLoad : function( dialog, func )
|
2547
|
+
{
|
2548
|
+
dialog.on( 'load', func, this );
|
2549
|
+
},
|
2550
|
+
|
2551
|
+
onShow : function( dialog, func )
|
2552
|
+
{
|
2553
|
+
dialog.on( 'show', func, this );
|
2554
|
+
},
|
2555
|
+
|
2556
|
+
onHide : function( dialog, func )
|
2557
|
+
{
|
2558
|
+
dialog.on( 'hide', func, this );
|
2559
|
+
}
|
2560
|
+
},
|
2561
|
+
|
2562
|
+
/**
|
2563
|
+
* The default handler for a UI element's access key down event, which
|
2564
|
+
* tries to put focus to the UI element.<br />
|
2565
|
+
* Can be overridded in child classes for more sophisticaed behavior.
|
2566
|
+
* @param {CKEDITOR.dialog} dialog The parent dialog object.
|
2567
|
+
* @param {String} key The key combination pressed. Since access keys
|
2568
|
+
* are defined to always include the CTRL key, its value should always
|
2569
|
+
* include a 'CTRL+' prefix.
|
2570
|
+
* @example
|
2571
|
+
*/
|
2572
|
+
accessKeyDown : function( dialog, key )
|
2573
|
+
{
|
2574
|
+
this.focus();
|
2575
|
+
},
|
2576
|
+
|
2577
|
+
/**
|
2578
|
+
* The default handler for a UI element's access key up event, which
|
2579
|
+
* does nothing.<br />
|
2580
|
+
* Can be overridded in child classes for more sophisticated behavior.
|
2581
|
+
* @param {CKEDITOR.dialog} dialog The parent dialog object.
|
2582
|
+
* @param {String} key The key combination pressed. Since access keys
|
2583
|
+
* are defined to always include the CTRL key, its value should always
|
2584
|
+
* include a 'CTRL+' prefix.
|
2585
|
+
* @example
|
2586
|
+
*/
|
2587
|
+
accessKeyUp : function( dialog, key )
|
2588
|
+
{
|
2589
|
+
},
|
2590
|
+
|
2591
|
+
/**
|
2592
|
+
* Disables a UI element.
|
2593
|
+
* @example
|
2594
|
+
*/
|
2595
|
+
disable : function()
|
2596
|
+
{
|
2597
|
+
var element = this.getInputElement();
|
2598
|
+
element.setAttribute( 'disabled', 'true' );
|
2599
|
+
element.addClass( 'cke_disabled' );
|
2600
|
+
},
|
2601
|
+
|
2602
|
+
/**
|
2603
|
+
* Enables a UI element.
|
2604
|
+
* @example
|
2605
|
+
*/
|
2606
|
+
enable : function()
|
2607
|
+
{
|
2608
|
+
var element = this.getInputElement();
|
2609
|
+
element.removeAttribute( 'disabled' );
|
2610
|
+
element.removeClass( 'cke_disabled' );
|
2611
|
+
},
|
2612
|
+
|
2613
|
+
/**
|
2614
|
+
* Determines whether an UI element is enabled or not.
|
2615
|
+
* @returns {Boolean} Whether the UI element is enabled.
|
2616
|
+
* @example
|
2617
|
+
*/
|
2618
|
+
isEnabled : function()
|
2619
|
+
{
|
2620
|
+
return !this.getInputElement().getAttribute( 'disabled' );
|
2621
|
+
},
|
2622
|
+
|
2623
|
+
/**
|
2624
|
+
* Determines whether an UI element is visible or not.
|
2625
|
+
* @returns {Boolean} Whether the UI element is visible.
|
2626
|
+
* @example
|
2627
|
+
*/
|
2628
|
+
isVisible : function()
|
2629
|
+
{
|
2630
|
+
return this.getInputElement().isVisible();
|
2631
|
+
},
|
2632
|
+
|
2633
|
+
/**
|
2634
|
+
* Determines whether an UI element is focus-able or not.
|
2635
|
+
* Focus-able is defined as being both visible and enabled.
|
2636
|
+
* @returns {Boolean} Whether the UI element can be focused.
|
2637
|
+
* @example
|
2638
|
+
*/
|
2639
|
+
isFocusable : function()
|
2640
|
+
{
|
2641
|
+
if ( !this.isEnabled() || !this.isVisible() )
|
2642
|
+
return false;
|
2643
|
+
return true;
|
2644
|
+
}
|
2645
|
+
};
|
2646
|
+
|
2647
|
+
CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
|
2648
|
+
/**
|
2649
|
+
* @lends CKEDITOR.ui.dialog.hbox.prototype
|
2650
|
+
*/
|
2651
|
+
{
|
2652
|
+
/**
|
2653
|
+
* Gets a child UI element inside this container.
|
2654
|
+
* @param {Array|Number} indices An array or a single number to indicate the child's
|
2655
|
+
* position in the container's descendant tree. Omit to get all the children in an array.
|
2656
|
+
* @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container
|
2657
|
+
* if no argument given, or the specified UI element if indices is given.
|
2658
|
+
* @example
|
2659
|
+
* var checkbox = hbox.getChild( [0,1] );
|
2660
|
+
* checkbox.setValue( true );
|
2661
|
+
*/
|
2662
|
+
getChild : function( indices )
|
2663
|
+
{
|
2664
|
+
// If no arguments, return a clone of the children array.
|
2665
|
+
if ( arguments.length < 1 )
|
2666
|
+
return this._.children.concat();
|
2667
|
+
|
2668
|
+
// If indices isn't array, make it one.
|
2669
|
+
if ( !indices.splice )
|
2670
|
+
indices = [ indices ];
|
2671
|
+
|
2672
|
+
// Retrieve the child element according to tree position.
|
2673
|
+
if ( indices.length < 2 )
|
2674
|
+
return this._.children[ indices[0] ];
|
2675
|
+
else
|
2676
|
+
return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ?
|
2677
|
+
this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) :
|
2678
|
+
null;
|
2679
|
+
}
|
2680
|
+
}, true );
|
2681
|
+
|
2682
|
+
CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox();
|
2683
|
+
|
2684
|
+
|
2685
|
+
|
2686
|
+
(function()
|
2687
|
+
{
|
2688
|
+
var commonBuilder = {
|
2689
|
+
build : function( dialog, elementDefinition, output )
|
2690
|
+
{
|
2691
|
+
var children = elementDefinition.children,
|
2692
|
+
child,
|
2693
|
+
childHtmlList = [],
|
2694
|
+
childObjList = [];
|
2695
|
+
for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
|
2696
|
+
{
|
2697
|
+
var childHtml = [];
|
2698
|
+
childHtmlList.push( childHtml );
|
2699
|
+
childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
|
2700
|
+
}
|
2701
|
+
return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition );
|
2702
|
+
}
|
2703
|
+
};
|
2704
|
+
|
2705
|
+
CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder );
|
2706
|
+
CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder );
|
2707
|
+
})();
|
2708
|
+
|
2709
|
+
/**
|
2710
|
+
* Generic dialog command. It opens a specific dialog when executed.
|
2711
|
+
* @constructor
|
2712
|
+
* @augments CKEDITOR.commandDefinition
|
2713
|
+
* @param {string} dialogName The name of the dialog to open when executing
|
2714
|
+
* this command.
|
2715
|
+
* @example
|
2716
|
+
* // Register the "link" command, which opens the "link" dialog.
|
2717
|
+
* editor.addCommand( 'link', <b>new CKEDITOR.dialogCommand( 'link' )</b> );
|
2718
|
+
*/
|
2719
|
+
CKEDITOR.dialogCommand = function( dialogName )
|
2720
|
+
{
|
2721
|
+
this.dialogName = dialogName;
|
2722
|
+
};
|
2723
|
+
|
2724
|
+
CKEDITOR.dialogCommand.prototype =
|
2725
|
+
{
|
2726
|
+
/** @ignore */
|
2727
|
+
exec : function( editor )
|
2728
|
+
{
|
2729
|
+
editor.openDialog( this.dialogName );
|
2730
|
+
},
|
2731
|
+
|
2732
|
+
// Dialog commands just open a dialog ui, thus require no undo logic,
|
2733
|
+
// undo support should dedicate to specific dialog implementation.
|
2734
|
+
canUndo: false,
|
2735
|
+
|
2736
|
+
editorFocus : CKEDITOR.env.ie || CKEDITOR.env.webkit
|
2737
|
+
};
|
2738
|
+
|
2739
|
+
(function()
|
2740
|
+
{
|
2741
|
+
var notEmptyRegex = /^([a]|[^a])+$/,
|
2742
|
+
integerRegex = /^\d*$/,
|
2743
|
+
numberRegex = /^\d*(?:\.\d+)?$/;
|
2744
|
+
|
2745
|
+
CKEDITOR.VALIDATE_OR = 1;
|
2746
|
+
CKEDITOR.VALIDATE_AND = 2;
|
2747
|
+
|
2748
|
+
CKEDITOR.dialog.validate =
|
2749
|
+
{
|
2750
|
+
functions : function()
|
2751
|
+
{
|
2752
|
+
return function()
|
2753
|
+
{
|
2754
|
+
/**
|
2755
|
+
* It's important for validate functions to be able to accept the value
|
2756
|
+
* as argument in addition to this.getValue(), so that it is possible to
|
2757
|
+
* combine validate functions together to make more sophisticated
|
2758
|
+
* validators.
|
2759
|
+
*/
|
2760
|
+
var value = this && this.getValue ? this.getValue() : arguments[0];
|
2761
|
+
|
2762
|
+
var msg = undefined,
|
2763
|
+
relation = CKEDITOR.VALIDATE_AND,
|
2764
|
+
functions = [], i;
|
2765
|
+
|
2766
|
+
for ( i = 0 ; i < arguments.length ; i++ )
|
2767
|
+
{
|
2768
|
+
if ( typeof( arguments[i] ) == 'function' )
|
2769
|
+
functions.push( arguments[i] );
|
2770
|
+
else
|
2771
|
+
break;
|
2772
|
+
}
|
2773
|
+
|
2774
|
+
if ( i < arguments.length && typeof( arguments[i] ) == 'string' )
|
2775
|
+
{
|
2776
|
+
msg = arguments[i];
|
2777
|
+
i++;
|
2778
|
+
}
|
2779
|
+
|
2780
|
+
if ( i < arguments.length && typeof( arguments[i]) == 'number' )
|
2781
|
+
relation = arguments[i];
|
2782
|
+
|
2783
|
+
var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false );
|
2784
|
+
for ( i = 0 ; i < functions.length ; i++ )
|
2785
|
+
{
|
2786
|
+
if ( relation == CKEDITOR.VALIDATE_AND )
|
2787
|
+
passed = passed && functions[i]( value );
|
2788
|
+
else
|
2789
|
+
passed = passed || functions[i]( value );
|
2790
|
+
}
|
2791
|
+
|
2792
|
+
if ( !passed )
|
2793
|
+
{
|
2794
|
+
if ( msg !== undefined )
|
2795
|
+
alert( msg );
|
2796
|
+
if ( this && ( this.select || this.focus ) )
|
2797
|
+
( this.select || this.focus )();
|
2798
|
+
return false;
|
2799
|
+
}
|
2800
|
+
|
2801
|
+
return true;
|
2802
|
+
};
|
2803
|
+
},
|
2804
|
+
|
2805
|
+
regex : function( regex, msg )
|
2806
|
+
{
|
2807
|
+
/*
|
2808
|
+
* Can be greatly shortened by deriving from functions validator if code size
|
2809
|
+
* turns out to be more important than performance.
|
2810
|
+
*/
|
2811
|
+
return function()
|
2812
|
+
{
|
2813
|
+
var value = this && this.getValue ? this.getValue() : arguments[0];
|
2814
|
+
if ( !regex.test( value ) )
|
2815
|
+
{
|
2816
|
+
if ( msg !== undefined )
|
2817
|
+
alert( msg );
|
2818
|
+
if ( this && ( this.select || this.focus ) )
|
2819
|
+
{
|
2820
|
+
if ( this.select )
|
2821
|
+
this.select();
|
2822
|
+
else
|
2823
|
+
this.focus();
|
2824
|
+
}
|
2825
|
+
return false;
|
2826
|
+
}
|
2827
|
+
return true;
|
2828
|
+
};
|
2829
|
+
},
|
2830
|
+
|
2831
|
+
notEmpty : function( msg )
|
2832
|
+
{
|
2833
|
+
return this.regex( notEmptyRegex, msg );
|
2834
|
+
},
|
2835
|
+
|
2836
|
+
integer : function( msg )
|
2837
|
+
{
|
2838
|
+
return this.regex( integerRegex, msg );
|
2839
|
+
},
|
2840
|
+
|
2841
|
+
'number' : function( msg )
|
2842
|
+
{
|
2843
|
+
return this.regex( numberRegex, msg );
|
2844
|
+
},
|
2845
|
+
|
2846
|
+
equals : function( value, msg )
|
2847
|
+
{
|
2848
|
+
return this.functions( function( val ){ return val == value; }, msg );
|
2849
|
+
},
|
2850
|
+
|
2851
|
+
notEqual : function( value, msg )
|
2852
|
+
{
|
2853
|
+
return this.functions( function( val ){ return val != value; }, msg );
|
2854
|
+
}
|
2855
|
+
};
|
2856
|
+
|
2857
|
+
CKEDITOR.on( 'instanceDestroyed', function( evt )
|
2858
|
+
{
|
2859
|
+
// Remove dialog cover on last instance destroy.
|
2860
|
+
if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) )
|
2861
|
+
{
|
2862
|
+
var currentTopDialog;
|
2863
|
+
while ( ( currentTopDialog = CKEDITOR.dialog._.currentTop ) )
|
2864
|
+
currentTopDialog.hide();
|
2865
|
+
removeCovers();
|
2866
|
+
}
|
2867
|
+
|
2868
|
+
var dialogs = evt.editor._.storedDialogs;
|
2869
|
+
for ( var name in dialogs )
|
2870
|
+
dialogs[ name ].destroy();
|
2871
|
+
|
2872
|
+
});
|
2873
|
+
|
2874
|
+
})();
|
2875
|
+
})();
|
2876
|
+
|
2877
|
+
// Extend the CKEDITOR.editor class with dialog specific functions.
|
2878
|
+
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
|
2879
|
+
/** @lends CKEDITOR.editor.prototype */
|
2880
|
+
{
|
2881
|
+
/**
|
2882
|
+
* Loads and opens a registered dialog.
|
2883
|
+
* @param {String} dialogName The registered name of the dialog.
|
2884
|
+
* @param {Function} callback The function to be invoked after dialog instance created.
|
2885
|
+
* @see CKEDITOR.dialog.add
|
2886
|
+
* @example
|
2887
|
+
* CKEDITOR.instances.editor1.openDialog( 'smiley' );
|
2888
|
+
* @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered.
|
2889
|
+
*/
|
2890
|
+
openDialog : function( dialogName, callback )
|
2891
|
+
{
|
2892
|
+
var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
|
2893
|
+
dialogSkin = this.skin.dialog;
|
2894
|
+
|
2895
|
+
// If the dialogDefinition is already loaded, open it immediately.
|
2896
|
+
if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded )
|
2897
|
+
{
|
2898
|
+
var storedDialogs = this._.storedDialogs ||
|
2899
|
+
( this._.storedDialogs = {} );
|
2900
|
+
|
2901
|
+
var dialog = storedDialogs[ dialogName ] ||
|
2902
|
+
( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
|
2903
|
+
|
2904
|
+
callback && callback.call( dialog, dialog );
|
2905
|
+
dialog.show();
|
2906
|
+
|
2907
|
+
return dialog;
|
2908
|
+
}
|
2909
|
+
else if ( dialogDefinitions == 'failed' )
|
2910
|
+
throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );
|
2911
|
+
|
2912
|
+
// Not loaded? Load the .js file first.
|
2913
|
+
var body = CKEDITOR.document.getBody(),
|
2914
|
+
cursor = body.$.style.cursor,
|
2915
|
+
me = this;
|
2916
|
+
|
2917
|
+
body.setStyle( 'cursor', 'wait' );
|
2918
|
+
|
2919
|
+
function onDialogFileLoaded( success )
|
2920
|
+
{
|
2921
|
+
var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
|
2922
|
+
skin = me.skin.dialog;
|
2923
|
+
|
2924
|
+
// Check if both skin part and definition is loaded.
|
2925
|
+
if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )
|
2926
|
+
return;
|
2927
|
+
|
2928
|
+
// In case of plugin error, mark it as loading failed.
|
2929
|
+
if ( typeof dialogDefinition != 'function' )
|
2930
|
+
CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';
|
2931
|
+
|
2932
|
+
me.openDialog( dialogName, callback );
|
2933
|
+
body.setStyle( 'cursor', cursor );
|
2934
|
+
}
|
2935
|
+
|
2936
|
+
if ( typeof dialogDefinitions == 'string' )
|
2937
|
+
{
|
2938
|
+
var loadDefinition = 1;
|
2939
|
+
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded );
|
2940
|
+
}
|
2941
|
+
|
2942
|
+
CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );
|
2943
|
+
|
2944
|
+
return null;
|
2945
|
+
}
|
2946
|
+
});
|
2947
|
+
|
2948
|
+
CKEDITOR.plugins.add( 'dialog',
|
2949
|
+
{
|
2950
|
+
requires : [ 'dialogui' ]
|
2951
|
+
});
|
2952
|
+
|
2953
|
+
// Dialog related configurations.
|
2954
|
+
|
2955
|
+
/**
|
2956
|
+
* The color of the dialog background cover. It should be a valid CSS color
|
2957
|
+
* string.
|
2958
|
+
* @name CKEDITOR.config.dialog_backgroundCoverColor
|
2959
|
+
* @type String
|
2960
|
+
* @default 'white'
|
2961
|
+
* @example
|
2962
|
+
* config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)';
|
2963
|
+
*/
|
2964
|
+
|
2965
|
+
/**
|
2966
|
+
* The opacity of the dialog background cover. It should be a number within the
|
2967
|
+
* range [0.0, 1.0].
|
2968
|
+
* @name CKEDITOR.config.dialog_backgroundCoverOpacity
|
2969
|
+
* @type Number
|
2970
|
+
* @default 0.5
|
2971
|
+
* @example
|
2972
|
+
* config.dialog_backgroundCoverOpacity = 0.7;
|
2973
|
+
*/
|
2974
|
+
|
2975
|
+
/**
|
2976
|
+
* If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened.
|
2977
|
+
* @name CKEDITOR.config.dialog_startupFocusTab
|
2978
|
+
* @type Boolean
|
2979
|
+
* @default false
|
2980
|
+
* @example
|
2981
|
+
* config.dialog_startupFocusTab = true;
|
2982
|
+
*/
|
2983
|
+
|
2984
|
+
/**
|
2985
|
+
* The distance of magnetic borders used in moving and resizing dialogs,
|
2986
|
+
* measured in pixels.
|
2987
|
+
* @name CKEDITOR.config.dialog_magnetDistance
|
2988
|
+
* @type Number
|
2989
|
+
* @default 20
|
2990
|
+
* @example
|
2991
|
+
* config.dialog_magnetDistance = 30;
|
2992
|
+
*/
|
2993
|
+
|
2994
|
+
/**
|
2995
|
+
* Fired when a dialog definition is about to be used to create a dialog into
|
2996
|
+
* an editor instance. This event makes it possible to customize the definition
|
2997
|
+
* before creating it.
|
2998
|
+
* <p>Note that this event is called only the first time a specific dialog is
|
2999
|
+
* opened. Successive openings will use the cached dialog, and this event will
|
3000
|
+
* not get fired.</p>
|
3001
|
+
* @name CKEDITOR#dialogDefinition
|
3002
|
+
* @event
|
3003
|
+
* @param {CKEDITOR.dialog.dialogDefinition} data The dialog defination that
|
3004
|
+
* is being loaded.
|
3005
|
+
* @param {CKEDITOR.editor} editor The editor instance that will use the
|
3006
|
+
* dialog.
|
3007
|
+
*/
|
3008
|
+
|
3009
|
+
/**
|
3010
|
+
* Fired when a tab is going to be selected in a dialog
|
3011
|
+
* @name dialog#selectPage
|
3012
|
+
* @event
|
3013
|
+
* @param String page The id of the page that it's gonna be selected.
|
3014
|
+
* @param String currentPage The id of the current page.
|
3015
|
+
*/
|