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,26 @@
|
|
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
|
+
* @class
|
8
|
+
*/
|
9
|
+
CKEDITOR.dom.nodeList = function( nativeList )
|
10
|
+
{
|
11
|
+
this.$ = nativeList;
|
12
|
+
};
|
13
|
+
|
14
|
+
CKEDITOR.dom.nodeList.prototype =
|
15
|
+
{
|
16
|
+
count : function()
|
17
|
+
{
|
18
|
+
return this.$.length;
|
19
|
+
},
|
20
|
+
|
21
|
+
getItem : function( index )
|
22
|
+
{
|
23
|
+
var $node = this.$[ index ];
|
24
|
+
return $node ? new CKEDITOR.dom.node( $node ) : null;
|
25
|
+
}
|
26
|
+
};
|
@@ -0,0 +1,1883 @@
|
|
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
|
+
* @class
|
8
|
+
*/
|
9
|
+
CKEDITOR.dom.range = function( document )
|
10
|
+
{
|
11
|
+
this.startContainer = null;
|
12
|
+
this.startOffset = null;
|
13
|
+
this.endContainer = null;
|
14
|
+
this.endOffset = null;
|
15
|
+
this.collapsed = true;
|
16
|
+
|
17
|
+
this.document = document;
|
18
|
+
};
|
19
|
+
|
20
|
+
(function()
|
21
|
+
{
|
22
|
+
// Updates the "collapsed" property for the given range object.
|
23
|
+
var updateCollapsed = function( range )
|
24
|
+
{
|
25
|
+
range.collapsed = (
|
26
|
+
range.startContainer &&
|
27
|
+
range.endContainer &&
|
28
|
+
range.startContainer.equals( range.endContainer ) &&
|
29
|
+
range.startOffset == range.endOffset );
|
30
|
+
};
|
31
|
+
|
32
|
+
// This is a shared function used to delete, extract and clone the range
|
33
|
+
// contents.
|
34
|
+
// V2
|
35
|
+
var execContentsAction = function( range, action, docFrag )
|
36
|
+
{
|
37
|
+
range.optimizeBookmark();
|
38
|
+
|
39
|
+
var startNode = range.startContainer;
|
40
|
+
var endNode = range.endContainer;
|
41
|
+
|
42
|
+
var startOffset = range.startOffset;
|
43
|
+
var endOffset = range.endOffset;
|
44
|
+
|
45
|
+
var removeStartNode;
|
46
|
+
var removeEndNode;
|
47
|
+
|
48
|
+
// For text containers, we must simply split the node and point to the
|
49
|
+
// second part. The removal will be handled by the rest of the code .
|
50
|
+
if ( endNode.type == CKEDITOR.NODE_TEXT )
|
51
|
+
endNode = endNode.split( endOffset );
|
52
|
+
else
|
53
|
+
{
|
54
|
+
// If the end container has children and the offset is pointing
|
55
|
+
// to a child, then we should start from it.
|
56
|
+
if ( endNode.getChildCount() > 0 )
|
57
|
+
{
|
58
|
+
// If the offset points after the last node.
|
59
|
+
if ( endOffset >= endNode.getChildCount() )
|
60
|
+
{
|
61
|
+
// Let's create a temporary node and mark it for removal.
|
62
|
+
endNode = endNode.append( range.document.createText( '' ) );
|
63
|
+
removeEndNode = true;
|
64
|
+
}
|
65
|
+
else
|
66
|
+
endNode = endNode.getChild( endOffset );
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
// For text containers, we must simply split the node. The removal will
|
71
|
+
// be handled by the rest of the code .
|
72
|
+
if ( startNode.type == CKEDITOR.NODE_TEXT )
|
73
|
+
{
|
74
|
+
startNode.split( startOffset );
|
75
|
+
|
76
|
+
// In cases the end node is the same as the start node, the above
|
77
|
+
// splitting will also split the end, so me must move the end to
|
78
|
+
// the second part of the split.
|
79
|
+
if ( startNode.equals( endNode ) )
|
80
|
+
endNode = startNode.getNext();
|
81
|
+
}
|
82
|
+
else
|
83
|
+
{
|
84
|
+
// If the start container has children and the offset is pointing
|
85
|
+
// to a child, then we should start from its previous sibling.
|
86
|
+
|
87
|
+
// If the offset points to the first node, we don't have a
|
88
|
+
// sibling, so let's use the first one, but mark it for removal.
|
89
|
+
if ( !startOffset )
|
90
|
+
{
|
91
|
+
// Let's create a temporary node and mark it for removal.
|
92
|
+
startNode = startNode.getFirst().insertBeforeMe( range.document.createText( '' ) );
|
93
|
+
removeStartNode = true;
|
94
|
+
}
|
95
|
+
else if ( startOffset >= startNode.getChildCount() )
|
96
|
+
{
|
97
|
+
// Let's create a temporary node and mark it for removal.
|
98
|
+
startNode = startNode.append( range.document.createText( '' ) );
|
99
|
+
removeStartNode = true;
|
100
|
+
}
|
101
|
+
else
|
102
|
+
startNode = startNode.getChild( startOffset ).getPrevious();
|
103
|
+
}
|
104
|
+
|
105
|
+
// Get the parent nodes tree for the start and end boundaries.
|
106
|
+
var startParents = startNode.getParents();
|
107
|
+
var endParents = endNode.getParents();
|
108
|
+
|
109
|
+
// Compare them, to find the top most siblings.
|
110
|
+
var i, topStart, topEnd;
|
111
|
+
|
112
|
+
for ( i = 0 ; i < startParents.length ; i++ )
|
113
|
+
{
|
114
|
+
topStart = startParents[ i ];
|
115
|
+
topEnd = endParents[ i ];
|
116
|
+
|
117
|
+
// The compared nodes will match until we find the top most
|
118
|
+
// siblings (different nodes that have the same parent).
|
119
|
+
// "i" will hold the index in the parents array for the top
|
120
|
+
// most element.
|
121
|
+
if ( !topStart.equals( topEnd ) )
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
|
125
|
+
var clone = docFrag, levelStartNode, levelClone, currentNode, currentSibling;
|
126
|
+
|
127
|
+
// Remove all successive sibling nodes for every node in the
|
128
|
+
// startParents tree.
|
129
|
+
for ( var j = i ; j < startParents.length ; j++ )
|
130
|
+
{
|
131
|
+
levelStartNode = startParents[j];
|
132
|
+
|
133
|
+
// For Extract and Clone, we must clone this level.
|
134
|
+
if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete
|
135
|
+
levelClone = clone.append( levelStartNode.clone() );
|
136
|
+
|
137
|
+
currentNode = levelStartNode.getNext();
|
138
|
+
|
139
|
+
while ( currentNode )
|
140
|
+
{
|
141
|
+
// Stop processing when the current node matches a node in the
|
142
|
+
// endParents tree or if it is the endNode.
|
143
|
+
if ( currentNode.equals( endParents[ j ] ) || currentNode.equals( endNode ) )
|
144
|
+
break;
|
145
|
+
|
146
|
+
// Cache the next sibling.
|
147
|
+
currentSibling = currentNode.getNext();
|
148
|
+
|
149
|
+
// If cloning, just clone it.
|
150
|
+
if ( action == 2 ) // 2 = Clone
|
151
|
+
clone.append( currentNode.clone( true ) );
|
152
|
+
else
|
153
|
+
{
|
154
|
+
// Both Delete and Extract will remove the node.
|
155
|
+
currentNode.remove();
|
156
|
+
|
157
|
+
// When Extracting, move the removed node to the docFrag.
|
158
|
+
if ( action == 1 ) // 1 = Extract
|
159
|
+
clone.append( currentNode );
|
160
|
+
}
|
161
|
+
|
162
|
+
currentNode = currentSibling;
|
163
|
+
}
|
164
|
+
|
165
|
+
if ( clone )
|
166
|
+
clone = levelClone;
|
167
|
+
}
|
168
|
+
|
169
|
+
clone = docFrag;
|
170
|
+
|
171
|
+
// Remove all previous sibling nodes for every node in the
|
172
|
+
// endParents tree.
|
173
|
+
for ( var k = i ; k < endParents.length ; k++ )
|
174
|
+
{
|
175
|
+
levelStartNode = endParents[ k ];
|
176
|
+
|
177
|
+
// For Extract and Clone, we must clone this level.
|
178
|
+
if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete
|
179
|
+
levelClone = clone.append( levelStartNode.clone() );
|
180
|
+
|
181
|
+
// The processing of siblings may have already been done by the parent.
|
182
|
+
if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode )
|
183
|
+
{
|
184
|
+
currentNode = levelStartNode.getPrevious();
|
185
|
+
|
186
|
+
while ( currentNode )
|
187
|
+
{
|
188
|
+
// Stop processing when the current node matches a node in the
|
189
|
+
// startParents tree or if it is the startNode.
|
190
|
+
if ( currentNode.equals( startParents[ k ] ) || currentNode.equals( startNode ) )
|
191
|
+
break;
|
192
|
+
|
193
|
+
// Cache the next sibling.
|
194
|
+
currentSibling = currentNode.getPrevious();
|
195
|
+
|
196
|
+
// If cloning, just clone it.
|
197
|
+
if ( action == 2 ) // 2 = Clone
|
198
|
+
clone.$.insertBefore( currentNode.$.cloneNode( true ), clone.$.firstChild ) ;
|
199
|
+
else
|
200
|
+
{
|
201
|
+
// Both Delete and Extract will remove the node.
|
202
|
+
currentNode.remove();
|
203
|
+
|
204
|
+
// When Extracting, mode the removed node to the docFrag.
|
205
|
+
if ( action == 1 ) // 1 = Extract
|
206
|
+
clone.$.insertBefore( currentNode.$, clone.$.firstChild );
|
207
|
+
}
|
208
|
+
|
209
|
+
currentNode = currentSibling;
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
if ( clone )
|
214
|
+
clone = levelClone;
|
215
|
+
}
|
216
|
+
|
217
|
+
if ( action == 2 ) // 2 = Clone.
|
218
|
+
{
|
219
|
+
// No changes in the DOM should be done, so fix the split text (if any).
|
220
|
+
|
221
|
+
var startTextNode = range.startContainer;
|
222
|
+
if ( startTextNode.type == CKEDITOR.NODE_TEXT )
|
223
|
+
{
|
224
|
+
startTextNode.$.data += startTextNode.$.nextSibling.data;
|
225
|
+
startTextNode.$.parentNode.removeChild( startTextNode.$.nextSibling );
|
226
|
+
}
|
227
|
+
|
228
|
+
var endTextNode = range.endContainer;
|
229
|
+
if ( endTextNode.type == CKEDITOR.NODE_TEXT && endTextNode.$.nextSibling )
|
230
|
+
{
|
231
|
+
endTextNode.$.data += endTextNode.$.nextSibling.data;
|
232
|
+
endTextNode.$.parentNode.removeChild( endTextNode.$.nextSibling );
|
233
|
+
}
|
234
|
+
}
|
235
|
+
else
|
236
|
+
{
|
237
|
+
// Collapse the range.
|
238
|
+
|
239
|
+
// If a node has been partially selected, collapse the range between
|
240
|
+
// topStart and topEnd. Otherwise, simply collapse it to the start. (W3C specs).
|
241
|
+
if ( topStart && topEnd && ( startNode.$.parentNode != topStart.$.parentNode || endNode.$.parentNode != topEnd.$.parentNode ) )
|
242
|
+
{
|
243
|
+
var endIndex = topEnd.getIndex();
|
244
|
+
|
245
|
+
// If the start node is to be removed, we must correct the
|
246
|
+
// index to reflect the removal.
|
247
|
+
if ( removeStartNode && topEnd.$.parentNode == startNode.$.parentNode )
|
248
|
+
endIndex--;
|
249
|
+
|
250
|
+
range.setStart( topEnd.getParent(), endIndex );
|
251
|
+
}
|
252
|
+
|
253
|
+
// Collapse it to the start.
|
254
|
+
range.collapse( true );
|
255
|
+
}
|
256
|
+
|
257
|
+
// Cleanup any marked node.
|
258
|
+
if ( removeStartNode )
|
259
|
+
startNode.remove();
|
260
|
+
|
261
|
+
if ( removeEndNode && endNode.$.parentNode )
|
262
|
+
endNode.remove();
|
263
|
+
};
|
264
|
+
|
265
|
+
var inlineChildReqElements = { abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 };
|
266
|
+
|
267
|
+
// Creates the appropriate node evaluator for the dom walker used inside
|
268
|
+
// check(Start|End)OfBlock.
|
269
|
+
function getCheckStartEndBlockEvalFunction( isStart )
|
270
|
+
{
|
271
|
+
var hadBr = false, bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true );
|
272
|
+
return function( node )
|
273
|
+
{
|
274
|
+
// First ignore bookmark nodes.
|
275
|
+
if ( bookmarkEvaluator( node ) )
|
276
|
+
return true;
|
277
|
+
|
278
|
+
if ( node.type == CKEDITOR.NODE_TEXT )
|
279
|
+
{
|
280
|
+
// If there's any visible text, then we're not at the start.
|
281
|
+
if ( CKEDITOR.tools.trim( node.getText() ).length )
|
282
|
+
return false;
|
283
|
+
}
|
284
|
+
else if ( node.type == CKEDITOR.NODE_ELEMENT )
|
285
|
+
{
|
286
|
+
// If there are non-empty inline elements (e.g. <img />), then we're not
|
287
|
+
// at the start.
|
288
|
+
if ( !inlineChildReqElements[ node.getName() ] )
|
289
|
+
{
|
290
|
+
// If we're working at the end-of-block, forgive the first <br /> in non-IE
|
291
|
+
// browsers.
|
292
|
+
if ( !isStart && !CKEDITOR.env.ie && node.getName() == 'br' && !hadBr )
|
293
|
+
hadBr = true;
|
294
|
+
else
|
295
|
+
return false;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
return true;
|
299
|
+
};
|
300
|
+
}
|
301
|
+
|
302
|
+
// Evaluator for CKEDITOR.dom.element::checkBoundaryOfElement, reject any
|
303
|
+
// text node and non-empty elements unless it's being bookmark text.
|
304
|
+
function elementBoundaryEval( node )
|
305
|
+
{
|
306
|
+
// Reject any text node unless it's being bookmark
|
307
|
+
// OR it's spaces. (#3883)
|
308
|
+
return node.type != CKEDITOR.NODE_TEXT
|
309
|
+
&& node.getName() in CKEDITOR.dtd.$removeEmpty
|
310
|
+
|| !CKEDITOR.tools.trim( node.getText() )
|
311
|
+
|| node.getParent().hasAttribute( '_cke_bookmark' );
|
312
|
+
}
|
313
|
+
|
314
|
+
var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
|
315
|
+
bookmarkEval = new CKEDITOR.dom.walker.bookmark();
|
316
|
+
|
317
|
+
function nonWhitespaceOrBookmarkEval( node )
|
318
|
+
{
|
319
|
+
// Whitespaces and bookmark nodes are to be ignored.
|
320
|
+
return !whitespaceEval( node ) && !bookmarkEval( node );
|
321
|
+
}
|
322
|
+
|
323
|
+
CKEDITOR.dom.range.prototype =
|
324
|
+
{
|
325
|
+
clone : function()
|
326
|
+
{
|
327
|
+
var clone = new CKEDITOR.dom.range( this.document );
|
328
|
+
|
329
|
+
clone.startContainer = this.startContainer;
|
330
|
+
clone.startOffset = this.startOffset;
|
331
|
+
clone.endContainer = this.endContainer;
|
332
|
+
clone.endOffset = this.endOffset;
|
333
|
+
clone.collapsed = this.collapsed;
|
334
|
+
|
335
|
+
return clone;
|
336
|
+
},
|
337
|
+
|
338
|
+
collapse : function( toStart )
|
339
|
+
{
|
340
|
+
if ( toStart )
|
341
|
+
{
|
342
|
+
this.endContainer = this.startContainer;
|
343
|
+
this.endOffset = this.startOffset;
|
344
|
+
}
|
345
|
+
else
|
346
|
+
{
|
347
|
+
this.startContainer = this.endContainer;
|
348
|
+
this.startOffset = this.endOffset;
|
349
|
+
}
|
350
|
+
|
351
|
+
this.collapsed = true;
|
352
|
+
},
|
353
|
+
|
354
|
+
// The selection may be lost when cloning (due to the splitText() call).
|
355
|
+
cloneContents : function()
|
356
|
+
{
|
357
|
+
var docFrag = new CKEDITOR.dom.documentFragment( this.document );
|
358
|
+
|
359
|
+
if ( !this.collapsed )
|
360
|
+
execContentsAction( this, 2, docFrag );
|
361
|
+
|
362
|
+
return docFrag;
|
363
|
+
},
|
364
|
+
|
365
|
+
deleteContents : function()
|
366
|
+
{
|
367
|
+
if ( this.collapsed )
|
368
|
+
return;
|
369
|
+
|
370
|
+
execContentsAction( this, 0 );
|
371
|
+
},
|
372
|
+
|
373
|
+
extractContents : function()
|
374
|
+
{
|
375
|
+
var docFrag = new CKEDITOR.dom.documentFragment( this.document );
|
376
|
+
|
377
|
+
if ( !this.collapsed )
|
378
|
+
execContentsAction( this, 1, docFrag );
|
379
|
+
|
380
|
+
return docFrag;
|
381
|
+
},
|
382
|
+
|
383
|
+
/**
|
384
|
+
* Creates a bookmark object, which can be later used to restore the
|
385
|
+
* range by using the moveToBookmark function.
|
386
|
+
* This is an "intrusive" way to create a bookmark. It includes <span> tags
|
387
|
+
* in the range boundaries. The advantage of it is that it is possible to
|
388
|
+
* handle DOM mutations when moving back to the bookmark.
|
389
|
+
* Attention: the inclusion of nodes in the DOM is a design choice and
|
390
|
+
* should not be changed as there are other points in the code that may be
|
391
|
+
* using those nodes to perform operations. See GetBookmarkNode.
|
392
|
+
* @param {Boolean} [serializable] Indicates that the bookmark nodes
|
393
|
+
* must contain ids, which can be used to restore the range even
|
394
|
+
* when these nodes suffer mutations (like a clonation or innerHTML
|
395
|
+
* change).
|
396
|
+
* @returns {Object} And object representing a bookmark.
|
397
|
+
*/
|
398
|
+
createBookmark : function( serializable )
|
399
|
+
{
|
400
|
+
var startNode, endNode;
|
401
|
+
var baseId;
|
402
|
+
var clone;
|
403
|
+
var collapsed = this.collapsed;
|
404
|
+
|
405
|
+
startNode = this.document.createElement( 'span' );
|
406
|
+
startNode.setAttribute( '_cke_bookmark', 1 );
|
407
|
+
startNode.setStyle( 'display', 'none' );
|
408
|
+
|
409
|
+
// For IE, it must have something inside, otherwise it may be
|
410
|
+
// removed during DOM operations.
|
411
|
+
startNode.setHtml( ' ' );
|
412
|
+
|
413
|
+
if ( serializable )
|
414
|
+
{
|
415
|
+
baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber();
|
416
|
+
startNode.setAttribute( 'id', baseId + 'S' );
|
417
|
+
}
|
418
|
+
|
419
|
+
// If collapsed, the endNode will not be created.
|
420
|
+
if ( !collapsed )
|
421
|
+
{
|
422
|
+
endNode = startNode.clone();
|
423
|
+
endNode.setHtml( ' ' );
|
424
|
+
|
425
|
+
if ( serializable )
|
426
|
+
endNode.setAttribute( 'id', baseId + 'E' );
|
427
|
+
|
428
|
+
clone = this.clone();
|
429
|
+
clone.collapse();
|
430
|
+
clone.insertNode( endNode );
|
431
|
+
}
|
432
|
+
|
433
|
+
clone = this.clone();
|
434
|
+
clone.collapse( true );
|
435
|
+
clone.insertNode( startNode );
|
436
|
+
|
437
|
+
// Update the range position.
|
438
|
+
if ( endNode )
|
439
|
+
{
|
440
|
+
this.setStartAfter( startNode );
|
441
|
+
this.setEndBefore( endNode );
|
442
|
+
}
|
443
|
+
else
|
444
|
+
this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END );
|
445
|
+
|
446
|
+
return {
|
447
|
+
startNode : serializable ? baseId + 'S' : startNode,
|
448
|
+
endNode : serializable ? baseId + 'E' : endNode,
|
449
|
+
serializable : serializable,
|
450
|
+
collapsed : collapsed
|
451
|
+
};
|
452
|
+
},
|
453
|
+
|
454
|
+
/**
|
455
|
+
* Creates a "non intrusive" and "mutation sensible" bookmark. This
|
456
|
+
* kind of bookmark should be used only when the DOM is supposed to
|
457
|
+
* remain stable after its creation.
|
458
|
+
* @param {Boolean} [normalized] Indicates that the bookmark must
|
459
|
+
* normalized. When normalized, the successive text nodes are
|
460
|
+
* considered a single node. To sucessful load a normalized
|
461
|
+
* bookmark, the DOM tree must be also normalized before calling
|
462
|
+
* moveToBookmark.
|
463
|
+
* @returns {Object} An object representing the bookmark.
|
464
|
+
*/
|
465
|
+
createBookmark2 : function( normalized )
|
466
|
+
{
|
467
|
+
var startContainer = this.startContainer,
|
468
|
+
endContainer = this.endContainer;
|
469
|
+
|
470
|
+
var startOffset = this.startOffset,
|
471
|
+
endOffset = this.endOffset;
|
472
|
+
|
473
|
+
var collapsed = this.collapsed;
|
474
|
+
|
475
|
+
var child, previous;
|
476
|
+
|
477
|
+
// If there is no range then get out of here.
|
478
|
+
// It happens on initial load in Safari #962 and if the editor it's
|
479
|
+
// hidden also in Firefox
|
480
|
+
if ( !startContainer || !endContainer )
|
481
|
+
return { start : 0, end : 0 };
|
482
|
+
|
483
|
+
if ( normalized )
|
484
|
+
{
|
485
|
+
// Find out if the start is pointing to a text node that will
|
486
|
+
// be normalized.
|
487
|
+
if ( startContainer.type == CKEDITOR.NODE_ELEMENT )
|
488
|
+
{
|
489
|
+
child = startContainer.getChild( startOffset );
|
490
|
+
|
491
|
+
// In this case, move the start information to that text
|
492
|
+
// node.
|
493
|
+
if ( child && child.type == CKEDITOR.NODE_TEXT
|
494
|
+
&& startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
|
495
|
+
{
|
496
|
+
startContainer = child;
|
497
|
+
startOffset = 0;
|
498
|
+
}
|
499
|
+
}
|
500
|
+
|
501
|
+
// Normalize the start.
|
502
|
+
while ( startContainer.type == CKEDITOR.NODE_TEXT
|
503
|
+
&& ( previous = startContainer.getPrevious() )
|
504
|
+
&& previous.type == CKEDITOR.NODE_TEXT )
|
505
|
+
{
|
506
|
+
startContainer = previous;
|
507
|
+
startOffset += previous.getLength();
|
508
|
+
}
|
509
|
+
|
510
|
+
// Process the end only if not normalized.
|
511
|
+
if ( !collapsed )
|
512
|
+
{
|
513
|
+
// Find out if the start is pointing to a text node that
|
514
|
+
// will be normalized.
|
515
|
+
if ( endContainer.type == CKEDITOR.NODE_ELEMENT )
|
516
|
+
{
|
517
|
+
child = endContainer.getChild( endOffset );
|
518
|
+
|
519
|
+
// In this case, move the start information to that
|
520
|
+
// text node.
|
521
|
+
if ( child && child.type == CKEDITOR.NODE_TEXT
|
522
|
+
&& endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
|
523
|
+
{
|
524
|
+
endContainer = child;
|
525
|
+
endOffset = 0;
|
526
|
+
}
|
527
|
+
}
|
528
|
+
|
529
|
+
// Normalize the end.
|
530
|
+
while ( endContainer.type == CKEDITOR.NODE_TEXT
|
531
|
+
&& ( previous = endContainer.getPrevious() )
|
532
|
+
&& previous.type == CKEDITOR.NODE_TEXT )
|
533
|
+
{
|
534
|
+
endContainer = previous;
|
535
|
+
endOffset += previous.getLength();
|
536
|
+
}
|
537
|
+
}
|
538
|
+
}
|
539
|
+
|
540
|
+
return {
|
541
|
+
start : startContainer.getAddress( normalized ),
|
542
|
+
end : collapsed ? null : endContainer.getAddress( normalized ),
|
543
|
+
startOffset : startOffset,
|
544
|
+
endOffset : endOffset,
|
545
|
+
normalized : normalized,
|
546
|
+
collapsed : collapsed,
|
547
|
+
is2 : true // It's a createBookmark2 bookmark.
|
548
|
+
};
|
549
|
+
},
|
550
|
+
|
551
|
+
moveToBookmark : function( bookmark )
|
552
|
+
{
|
553
|
+
if ( bookmark.is2 ) // Created with createBookmark2().
|
554
|
+
{
|
555
|
+
// Get the start information.
|
556
|
+
var startContainer = this.document.getByAddress( bookmark.start, bookmark.normalized ),
|
557
|
+
startOffset = bookmark.startOffset;
|
558
|
+
|
559
|
+
// Get the end information.
|
560
|
+
var endContainer = bookmark.end && this.document.getByAddress( bookmark.end, bookmark.normalized ),
|
561
|
+
endOffset = bookmark.endOffset;
|
562
|
+
|
563
|
+
// Set the start boundary.
|
564
|
+
this.setStart( startContainer, startOffset );
|
565
|
+
|
566
|
+
// Set the end boundary. If not available, collapse it.
|
567
|
+
if ( endContainer )
|
568
|
+
this.setEnd( endContainer, endOffset );
|
569
|
+
else
|
570
|
+
this.collapse( true );
|
571
|
+
}
|
572
|
+
else // Created with createBookmark().
|
573
|
+
{
|
574
|
+
var serializable = bookmark.serializable,
|
575
|
+
startNode = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode,
|
576
|
+
endNode = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode;
|
577
|
+
|
578
|
+
// Set the range start at the bookmark start node position.
|
579
|
+
this.setStartBefore( startNode );
|
580
|
+
|
581
|
+
// Remove it, because it may interfere in the setEndBefore call.
|
582
|
+
startNode.remove();
|
583
|
+
|
584
|
+
// Set the range end at the bookmark end node position, or simply
|
585
|
+
// collapse it if it is not available.
|
586
|
+
if ( endNode )
|
587
|
+
{
|
588
|
+
this.setEndBefore( endNode );
|
589
|
+
endNode.remove();
|
590
|
+
}
|
591
|
+
else
|
592
|
+
this.collapse( true );
|
593
|
+
}
|
594
|
+
},
|
595
|
+
|
596
|
+
getBoundaryNodes : function()
|
597
|
+
{
|
598
|
+
var startNode = this.startContainer,
|
599
|
+
endNode = this.endContainer,
|
600
|
+
startOffset = this.startOffset,
|
601
|
+
endOffset = this.endOffset,
|
602
|
+
childCount;
|
603
|
+
|
604
|
+
if ( startNode.type == CKEDITOR.NODE_ELEMENT )
|
605
|
+
{
|
606
|
+
childCount = startNode.getChildCount();
|
607
|
+
if ( childCount > startOffset )
|
608
|
+
startNode = startNode.getChild( startOffset );
|
609
|
+
else if ( childCount < 1 )
|
610
|
+
startNode = startNode.getPreviousSourceNode();
|
611
|
+
else // startOffset > childCount but childCount is not 0
|
612
|
+
{
|
613
|
+
// Try to take the node just after the current position.
|
614
|
+
startNode = startNode.$;
|
615
|
+
while ( startNode.lastChild )
|
616
|
+
startNode = startNode.lastChild;
|
617
|
+
startNode = new CKEDITOR.dom.node( startNode );
|
618
|
+
|
619
|
+
// Normally we should take the next node in DFS order. But it
|
620
|
+
// is also possible that we've already reached the end of
|
621
|
+
// document.
|
622
|
+
startNode = startNode.getNextSourceNode() || startNode;
|
623
|
+
}
|
624
|
+
}
|
625
|
+
if ( endNode.type == CKEDITOR.NODE_ELEMENT )
|
626
|
+
{
|
627
|
+
childCount = endNode.getChildCount();
|
628
|
+
if ( childCount > endOffset )
|
629
|
+
endNode = endNode.getChild( endOffset ).getPreviousSourceNode( true );
|
630
|
+
else if ( childCount < 1 )
|
631
|
+
endNode = endNode.getPreviousSourceNode();
|
632
|
+
else // endOffset > childCount but childCount is not 0
|
633
|
+
{
|
634
|
+
// Try to take the node just before the current position.
|
635
|
+
endNode = endNode.$;
|
636
|
+
while ( endNode.lastChild )
|
637
|
+
endNode = endNode.lastChild;
|
638
|
+
endNode = new CKEDITOR.dom.node( endNode );
|
639
|
+
}
|
640
|
+
}
|
641
|
+
|
642
|
+
// Sometimes the endNode will come right before startNode for collapsed
|
643
|
+
// ranges. Fix it. (#3780)
|
644
|
+
if ( startNode.getPosition( endNode ) & CKEDITOR.POSITION_FOLLOWING )
|
645
|
+
startNode = endNode;
|
646
|
+
|
647
|
+
return { startNode : startNode, endNode : endNode };
|
648
|
+
},
|
649
|
+
|
650
|
+
/**
|
651
|
+
* Find the node which fully contains the range.
|
652
|
+
* @param includeSelf
|
653
|
+
* @param {Boolean} ignoreTextNode Whether ignore CKEDITOR.NODE_TEXT type.
|
654
|
+
*/
|
655
|
+
getCommonAncestor : function( includeSelf , ignoreTextNode )
|
656
|
+
{
|
657
|
+
var start = this.startContainer,
|
658
|
+
end = this.endContainer,
|
659
|
+
ancestor;
|
660
|
+
|
661
|
+
if ( start.equals( end ) )
|
662
|
+
{
|
663
|
+
if ( includeSelf
|
664
|
+
&& start.type == CKEDITOR.NODE_ELEMENT
|
665
|
+
&& this.startOffset == this.endOffset - 1 )
|
666
|
+
ancestor = start.getChild( this.startOffset );
|
667
|
+
else
|
668
|
+
ancestor = start;
|
669
|
+
}
|
670
|
+
else
|
671
|
+
ancestor = start.getCommonAncestor( end );
|
672
|
+
|
673
|
+
return ignoreTextNode && !ancestor.is ? ancestor.getParent() : ancestor;
|
674
|
+
},
|
675
|
+
|
676
|
+
/**
|
677
|
+
* Transforms the startContainer and endContainer properties from text
|
678
|
+
* nodes to element nodes, whenever possible. This is actually possible
|
679
|
+
* if either of the boundary containers point to a text node, and its
|
680
|
+
* offset is set to zero, or after the last char in the node.
|
681
|
+
*/
|
682
|
+
optimize : function()
|
683
|
+
{
|
684
|
+
var container = this.startContainer;
|
685
|
+
var offset = this.startOffset;
|
686
|
+
|
687
|
+
if ( container.type != CKEDITOR.NODE_ELEMENT )
|
688
|
+
{
|
689
|
+
if ( !offset )
|
690
|
+
this.setStartBefore( container );
|
691
|
+
else if ( offset >= container.getLength() )
|
692
|
+
this.setStartAfter( container );
|
693
|
+
}
|
694
|
+
|
695
|
+
container = this.endContainer;
|
696
|
+
offset = this.endOffset;
|
697
|
+
|
698
|
+
if ( container.type != CKEDITOR.NODE_ELEMENT )
|
699
|
+
{
|
700
|
+
if ( !offset )
|
701
|
+
this.setEndBefore( container );
|
702
|
+
else if ( offset >= container.getLength() )
|
703
|
+
this.setEndAfter( container );
|
704
|
+
}
|
705
|
+
},
|
706
|
+
|
707
|
+
/**
|
708
|
+
* Move the range out of bookmark nodes if they'd been the container.
|
709
|
+
*/
|
710
|
+
optimizeBookmark: function()
|
711
|
+
{
|
712
|
+
var startNode = this.startContainer,
|
713
|
+
endNode = this.endContainer;
|
714
|
+
|
715
|
+
if ( startNode.is && startNode.is( 'span' )
|
716
|
+
&& startNode.hasAttribute( '_cke_bookmark' ) )
|
717
|
+
this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );
|
718
|
+
if ( endNode && endNode.is && endNode.is( 'span' )
|
719
|
+
&& endNode.hasAttribute( '_cke_bookmark' ) )
|
720
|
+
this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END );
|
721
|
+
},
|
722
|
+
|
723
|
+
trim : function( ignoreStart, ignoreEnd )
|
724
|
+
{
|
725
|
+
var startContainer = this.startContainer,
|
726
|
+
startOffset = this.startOffset,
|
727
|
+
collapsed = this.collapsed;
|
728
|
+
if ( ( !ignoreStart || collapsed )
|
729
|
+
&& startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
|
730
|
+
{
|
731
|
+
// If the offset is zero, we just insert the new node before
|
732
|
+
// the start.
|
733
|
+
if ( !startOffset )
|
734
|
+
{
|
735
|
+
startOffset = startContainer.getIndex();
|
736
|
+
startContainer = startContainer.getParent();
|
737
|
+
}
|
738
|
+
// If the offset is at the end, we'll insert it after the text
|
739
|
+
// node.
|
740
|
+
else if ( startOffset >= startContainer.getLength() )
|
741
|
+
{
|
742
|
+
startOffset = startContainer.getIndex() + 1;
|
743
|
+
startContainer = startContainer.getParent();
|
744
|
+
}
|
745
|
+
// In other case, we split the text node and insert the new
|
746
|
+
// node at the split point.
|
747
|
+
else
|
748
|
+
{
|
749
|
+
var nextText = startContainer.split( startOffset );
|
750
|
+
|
751
|
+
startOffset = startContainer.getIndex() + 1;
|
752
|
+
startContainer = startContainer.getParent();
|
753
|
+
|
754
|
+
// Check all necessity of updating the end boundary.
|
755
|
+
if ( this.startContainer.equals( this.endContainer ) )
|
756
|
+
this.setEnd( nextText, this.endOffset - this.startOffset );
|
757
|
+
else if ( startContainer.equals( this.endContainer ) )
|
758
|
+
this.endOffset += 1;
|
759
|
+
}
|
760
|
+
|
761
|
+
this.setStart( startContainer, startOffset );
|
762
|
+
|
763
|
+
if ( collapsed )
|
764
|
+
{
|
765
|
+
this.collapse( true );
|
766
|
+
return;
|
767
|
+
}
|
768
|
+
}
|
769
|
+
|
770
|
+
var endContainer = this.endContainer;
|
771
|
+
var endOffset = this.endOffset;
|
772
|
+
|
773
|
+
if ( !( ignoreEnd || collapsed )
|
774
|
+
&& endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
|
775
|
+
{
|
776
|
+
// If the offset is zero, we just insert the new node before
|
777
|
+
// the start.
|
778
|
+
if ( !endOffset )
|
779
|
+
{
|
780
|
+
endOffset = endContainer.getIndex();
|
781
|
+
endContainer = endContainer.getParent();
|
782
|
+
}
|
783
|
+
// If the offset is at the end, we'll insert it after the text
|
784
|
+
// node.
|
785
|
+
else if ( endOffset >= endContainer.getLength() )
|
786
|
+
{
|
787
|
+
endOffset = endContainer.getIndex() + 1;
|
788
|
+
endContainer = endContainer.getParent();
|
789
|
+
}
|
790
|
+
// In other case, we split the text node and insert the new
|
791
|
+
// node at the split point.
|
792
|
+
else
|
793
|
+
{
|
794
|
+
endContainer.split( endOffset );
|
795
|
+
|
796
|
+
endOffset = endContainer.getIndex() + 1;
|
797
|
+
endContainer = endContainer.getParent();
|
798
|
+
}
|
799
|
+
|
800
|
+
this.setEnd( endContainer, endOffset );
|
801
|
+
}
|
802
|
+
},
|
803
|
+
|
804
|
+
enlarge : function( unit )
|
805
|
+
{
|
806
|
+
switch ( unit )
|
807
|
+
{
|
808
|
+
case CKEDITOR.ENLARGE_ELEMENT :
|
809
|
+
|
810
|
+
if ( this.collapsed )
|
811
|
+
return;
|
812
|
+
|
813
|
+
// Get the common ancestor.
|
814
|
+
var commonAncestor = this.getCommonAncestor();
|
815
|
+
|
816
|
+
var body = this.document.getBody();
|
817
|
+
|
818
|
+
// For each boundary
|
819
|
+
// a. Depending on its position, find out the first node to be checked (a sibling) or, if not available, to be enlarge.
|
820
|
+
// b. Go ahead checking siblings and enlarging the boundary as much as possible until the common ancestor is not reached. After reaching the common ancestor, just save the enlargeable node to be used later.
|
821
|
+
|
822
|
+
var startTop, endTop;
|
823
|
+
|
824
|
+
var enlargeable, sibling, commonReached;
|
825
|
+
|
826
|
+
// Indicates that the node can be added only if whitespace
|
827
|
+
// is available before it.
|
828
|
+
var needsWhiteSpace = false;
|
829
|
+
var isWhiteSpace;
|
830
|
+
var siblingText;
|
831
|
+
|
832
|
+
// Process the start boundary.
|
833
|
+
|
834
|
+
var container = this.startContainer;
|
835
|
+
var offset = this.startOffset;
|
836
|
+
|
837
|
+
if ( container.type == CKEDITOR.NODE_TEXT )
|
838
|
+
{
|
839
|
+
if ( offset )
|
840
|
+
{
|
841
|
+
// Check if there is any non-space text before the
|
842
|
+
// offset. Otherwise, container is null.
|
843
|
+
container = !CKEDITOR.tools.trim( container.substring( 0, offset ) ).length && container;
|
844
|
+
|
845
|
+
// If we found only whitespace in the node, it
|
846
|
+
// means that we'll need more whitespace to be able
|
847
|
+
// to expand. For example, <i> can be expanded in
|
848
|
+
// "A <i> [B]</i>", but not in "A<i> [B]</i>".
|
849
|
+
needsWhiteSpace = !!container;
|
850
|
+
}
|
851
|
+
|
852
|
+
if ( container )
|
853
|
+
{
|
854
|
+
if ( !( sibling = container.getPrevious() ) )
|
855
|
+
enlargeable = container.getParent();
|
856
|
+
}
|
857
|
+
}
|
858
|
+
else
|
859
|
+
{
|
860
|
+
// If we have offset, get the node preceeding it as the
|
861
|
+
// first sibling to be checked.
|
862
|
+
if ( offset )
|
863
|
+
sibling = container.getChild( offset - 1 ) || container.getLast();
|
864
|
+
|
865
|
+
// If there is no sibling, mark the container to be
|
866
|
+
// enlarged.
|
867
|
+
if ( !sibling )
|
868
|
+
enlargeable = container;
|
869
|
+
}
|
870
|
+
|
871
|
+
while ( enlargeable || sibling )
|
872
|
+
{
|
873
|
+
if ( enlargeable && !sibling )
|
874
|
+
{
|
875
|
+
// If we reached the common ancestor, mark the flag
|
876
|
+
// for it.
|
877
|
+
if ( !commonReached && enlargeable.equals( commonAncestor ) )
|
878
|
+
commonReached = true;
|
879
|
+
|
880
|
+
if ( !body.contains( enlargeable ) )
|
881
|
+
break;
|
882
|
+
|
883
|
+
// If we don't need space or this element breaks
|
884
|
+
// the line, then enlarge it.
|
885
|
+
if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
|
886
|
+
{
|
887
|
+
needsWhiteSpace = false;
|
888
|
+
|
889
|
+
// If the common ancestor has been reached,
|
890
|
+
// we'll not enlarge it immediately, but just
|
891
|
+
// mark it to be enlarged later if the end
|
892
|
+
// boundary also enlarges it.
|
893
|
+
if ( commonReached )
|
894
|
+
startTop = enlargeable;
|
895
|
+
else
|
896
|
+
this.setStartBefore( enlargeable );
|
897
|
+
}
|
898
|
+
|
899
|
+
sibling = enlargeable.getPrevious();
|
900
|
+
}
|
901
|
+
|
902
|
+
// Check all sibling nodes preceeding the enlargeable
|
903
|
+
// node. The node wil lbe enlarged only if none of them
|
904
|
+
// blocks it.
|
905
|
+
while ( sibling )
|
906
|
+
{
|
907
|
+
// This flag indicates that this node has
|
908
|
+
// whitespaces at the end.
|
909
|
+
isWhiteSpace = false;
|
910
|
+
|
911
|
+
if ( sibling.type == CKEDITOR.NODE_TEXT )
|
912
|
+
{
|
913
|
+
siblingText = sibling.getText();
|
914
|
+
|
915
|
+
if ( /[^\s\ufeff]/.test( siblingText ) )
|
916
|
+
sibling = null;
|
917
|
+
|
918
|
+
isWhiteSpace = /[\s\ufeff]$/.test( siblingText );
|
919
|
+
}
|
920
|
+
else
|
921
|
+
{
|
922
|
+
// If this is a visible element.
|
923
|
+
// We need to check for the bookmark attribute because IE insists on
|
924
|
+
// rendering the display:none nodes we use for bookmarks. (#3363)
|
925
|
+
if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )
|
926
|
+
{
|
927
|
+
// We'll accept it only if we need
|
928
|
+
// whitespace, and this is an inline
|
929
|
+
// element with whitespace only.
|
930
|
+
if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] )
|
931
|
+
{
|
932
|
+
// It must contains spaces and inline elements only.
|
933
|
+
|
934
|
+
siblingText = sibling.getText();
|
935
|
+
|
936
|
+
if ( (/[^\s\ufeff]/).test( siblingText ) ) // Spaces + Zero Width No-Break Space (U+FEFF)
|
937
|
+
sibling = null;
|
938
|
+
else
|
939
|
+
{
|
940
|
+
var allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' );
|
941
|
+
for ( var i = 0, child ; child = allChildren[ i++ ] ; )
|
942
|
+
{
|
943
|
+
if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] )
|
944
|
+
{
|
945
|
+
sibling = null;
|
946
|
+
break;
|
947
|
+
}
|
948
|
+
}
|
949
|
+
}
|
950
|
+
|
951
|
+
if ( sibling )
|
952
|
+
isWhiteSpace = !!siblingText.length;
|
953
|
+
}
|
954
|
+
else
|
955
|
+
sibling = null;
|
956
|
+
}
|
957
|
+
}
|
958
|
+
|
959
|
+
// A node with whitespaces has been found.
|
960
|
+
if ( isWhiteSpace )
|
961
|
+
{
|
962
|
+
// Enlarge the last enlargeable node, if we
|
963
|
+
// were waiting for spaces.
|
964
|
+
if ( needsWhiteSpace )
|
965
|
+
{
|
966
|
+
if ( commonReached )
|
967
|
+
startTop = enlargeable;
|
968
|
+
else if ( enlargeable )
|
969
|
+
this.setStartBefore( enlargeable );
|
970
|
+
}
|
971
|
+
else
|
972
|
+
needsWhiteSpace = true;
|
973
|
+
}
|
974
|
+
|
975
|
+
if ( sibling )
|
976
|
+
{
|
977
|
+
var next = sibling.getPrevious();
|
978
|
+
|
979
|
+
if ( !enlargeable && !next )
|
980
|
+
{
|
981
|
+
// Set the sibling as enlargeable, so it's
|
982
|
+
// parent will be get later outside this while.
|
983
|
+
enlargeable = sibling;
|
984
|
+
sibling = null;
|
985
|
+
break;
|
986
|
+
}
|
987
|
+
|
988
|
+
sibling = next;
|
989
|
+
}
|
990
|
+
else
|
991
|
+
{
|
992
|
+
// If sibling has been set to null, then we
|
993
|
+
// need to stop enlarging.
|
994
|
+
enlargeable = null;
|
995
|
+
}
|
996
|
+
}
|
997
|
+
|
998
|
+
if ( enlargeable )
|
999
|
+
enlargeable = enlargeable.getParent();
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
// Process the end boundary. This is basically the same
|
1003
|
+
// code used for the start boundary, with small changes to
|
1004
|
+
// make it work in the oposite side (to the right). This
|
1005
|
+
// makes it difficult to reuse the code here. So, fixes to
|
1006
|
+
// the above code are likely to be replicated here.
|
1007
|
+
|
1008
|
+
container = this.endContainer;
|
1009
|
+
offset = this.endOffset;
|
1010
|
+
|
1011
|
+
// Reset the common variables.
|
1012
|
+
enlargeable = sibling = null;
|
1013
|
+
commonReached = needsWhiteSpace = false;
|
1014
|
+
|
1015
|
+
if ( container.type == CKEDITOR.NODE_TEXT )
|
1016
|
+
{
|
1017
|
+
// Check if there is any non-space text after the
|
1018
|
+
// offset. Otherwise, container is null.
|
1019
|
+
container = !CKEDITOR.tools.trim( container.substring( offset ) ).length && container;
|
1020
|
+
|
1021
|
+
// If we found only whitespace in the node, it
|
1022
|
+
// means that we'll need more whitespace to be able
|
1023
|
+
// to expand. For example, <i> can be expanded in
|
1024
|
+
// "A <i> [B]</i>", but not in "A<i> [B]</i>".
|
1025
|
+
needsWhiteSpace = !( container && container.getLength() );
|
1026
|
+
|
1027
|
+
if ( container )
|
1028
|
+
{
|
1029
|
+
if ( !( sibling = container.getNext() ) )
|
1030
|
+
enlargeable = container.getParent();
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
else
|
1034
|
+
{
|
1035
|
+
// Get the node right after the boudary to be checked
|
1036
|
+
// first.
|
1037
|
+
sibling = container.getChild( offset );
|
1038
|
+
|
1039
|
+
if ( !sibling )
|
1040
|
+
enlargeable = container;
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
while ( enlargeable || sibling )
|
1044
|
+
{
|
1045
|
+
if ( enlargeable && !sibling )
|
1046
|
+
{
|
1047
|
+
if ( !commonReached && enlargeable.equals( commonAncestor ) )
|
1048
|
+
commonReached = true;
|
1049
|
+
|
1050
|
+
if ( !body.contains( enlargeable ) )
|
1051
|
+
break;
|
1052
|
+
|
1053
|
+
if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
|
1054
|
+
{
|
1055
|
+
needsWhiteSpace = false;
|
1056
|
+
|
1057
|
+
if ( commonReached )
|
1058
|
+
endTop = enlargeable;
|
1059
|
+
else if ( enlargeable )
|
1060
|
+
this.setEndAfter( enlargeable );
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
sibling = enlargeable.getNext();
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
while ( sibling )
|
1067
|
+
{
|
1068
|
+
isWhiteSpace = false;
|
1069
|
+
|
1070
|
+
if ( sibling.type == CKEDITOR.NODE_TEXT )
|
1071
|
+
{
|
1072
|
+
siblingText = sibling.getText();
|
1073
|
+
|
1074
|
+
if ( /[^\s\ufeff]/.test( siblingText ) )
|
1075
|
+
sibling = null;
|
1076
|
+
|
1077
|
+
isWhiteSpace = /^[\s\ufeff]/.test( siblingText );
|
1078
|
+
}
|
1079
|
+
else
|
1080
|
+
{
|
1081
|
+
// If this is a visible element.
|
1082
|
+
// We need to check for the bookmark attribute because IE insists on
|
1083
|
+
// rendering the display:none nodes we use for bookmarks. (#3363)
|
1084
|
+
if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )
|
1085
|
+
{
|
1086
|
+
// We'll accept it only if we need
|
1087
|
+
// whitespace, and this is an inline
|
1088
|
+
// element with whitespace only.
|
1089
|
+
if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] )
|
1090
|
+
{
|
1091
|
+
// It must contains spaces and inline elements only.
|
1092
|
+
|
1093
|
+
siblingText = sibling.getText();
|
1094
|
+
|
1095
|
+
if ( (/[^\s\ufeff]/).test( siblingText ) )
|
1096
|
+
sibling = null;
|
1097
|
+
else
|
1098
|
+
{
|
1099
|
+
allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' );
|
1100
|
+
for ( i = 0 ; child = allChildren[ i++ ] ; )
|
1101
|
+
{
|
1102
|
+
if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] )
|
1103
|
+
{
|
1104
|
+
sibling = null;
|
1105
|
+
break;
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
if ( sibling )
|
1111
|
+
isWhiteSpace = !!siblingText.length;
|
1112
|
+
}
|
1113
|
+
else
|
1114
|
+
sibling = null;
|
1115
|
+
}
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
if ( isWhiteSpace )
|
1119
|
+
{
|
1120
|
+
if ( needsWhiteSpace )
|
1121
|
+
{
|
1122
|
+
if ( commonReached )
|
1123
|
+
endTop = enlargeable;
|
1124
|
+
else
|
1125
|
+
this.setEndAfter( enlargeable );
|
1126
|
+
}
|
1127
|
+
}
|
1128
|
+
|
1129
|
+
if ( sibling )
|
1130
|
+
{
|
1131
|
+
next = sibling.getNext();
|
1132
|
+
|
1133
|
+
if ( !enlargeable && !next )
|
1134
|
+
{
|
1135
|
+
enlargeable = sibling;
|
1136
|
+
sibling = null;
|
1137
|
+
break;
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
sibling = next;
|
1141
|
+
}
|
1142
|
+
else
|
1143
|
+
{
|
1144
|
+
// If sibling has been set to null, then we
|
1145
|
+
// need to stop enlarging.
|
1146
|
+
enlargeable = null;
|
1147
|
+
}
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
if ( enlargeable )
|
1151
|
+
enlargeable = enlargeable.getParent();
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
// If the common ancestor can be enlarged by both boundaries, then include it also.
|
1155
|
+
if ( startTop && endTop )
|
1156
|
+
{
|
1157
|
+
commonAncestor = startTop.contains( endTop ) ? endTop : startTop;
|
1158
|
+
|
1159
|
+
this.setStartBefore( commonAncestor );
|
1160
|
+
this.setEndAfter( commonAncestor );
|
1161
|
+
}
|
1162
|
+
break;
|
1163
|
+
|
1164
|
+
case CKEDITOR.ENLARGE_BLOCK_CONTENTS:
|
1165
|
+
case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:
|
1166
|
+
|
1167
|
+
// Enlarging the start boundary.
|
1168
|
+
var walkerRange = new CKEDITOR.dom.range( this.document );
|
1169
|
+
|
1170
|
+
body = this.document.getBody();
|
1171
|
+
|
1172
|
+
walkerRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START );
|
1173
|
+
walkerRange.setEnd( this.startContainer, this.startOffset );
|
1174
|
+
|
1175
|
+
var walker = new CKEDITOR.dom.walker( walkerRange ),
|
1176
|
+
blockBoundary, // The node on which the enlarging should stop.
|
1177
|
+
tailBr, // In case BR as block boundary.
|
1178
|
+
notBlockBoundary = CKEDITOR.dom.walker.blockBoundary(
|
1179
|
+
( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null ),
|
1180
|
+
// Record the encountered 'blockBoundary' for later use.
|
1181
|
+
boundaryGuard = function( node )
|
1182
|
+
{
|
1183
|
+
var retval = notBlockBoundary( node );
|
1184
|
+
if ( !retval )
|
1185
|
+
blockBoundary = node;
|
1186
|
+
return retval;
|
1187
|
+
},
|
1188
|
+
// Record the encounted 'tailBr' for later use.
|
1189
|
+
tailBrGuard = function( node )
|
1190
|
+
{
|
1191
|
+
var retval = boundaryGuard( node );
|
1192
|
+
if ( !retval && node.is && node.is( 'br' ) )
|
1193
|
+
tailBr = node;
|
1194
|
+
return retval;
|
1195
|
+
};
|
1196
|
+
|
1197
|
+
walker.guard = boundaryGuard;
|
1198
|
+
|
1199
|
+
enlargeable = walker.lastBackward();
|
1200
|
+
|
1201
|
+
// It's the body which stop the enlarging if no block boundary found.
|
1202
|
+
blockBoundary = blockBoundary || body;
|
1203
|
+
|
1204
|
+
// Start the range either after the end of found block (<p>...</p>[text)
|
1205
|
+
// or at the start of block (<p>[text...), by comparing the document position
|
1206
|
+
// with 'enlargeable' node.
|
1207
|
+
this.setStartAt(
|
1208
|
+
blockBoundary,
|
1209
|
+
!blockBoundary.is( 'br' ) &&
|
1210
|
+
( !enlargeable && this.checkStartOfBlock()
|
1211
|
+
|| enlargeable && blockBoundary.contains( enlargeable ) ) ?
|
1212
|
+
CKEDITOR.POSITION_AFTER_START :
|
1213
|
+
CKEDITOR.POSITION_AFTER_END );
|
1214
|
+
|
1215
|
+
// Enlarging the end boundary.
|
1216
|
+
walkerRange = this.clone();
|
1217
|
+
walkerRange.collapse();
|
1218
|
+
walkerRange.setEndAt( body, CKEDITOR.POSITION_BEFORE_END );
|
1219
|
+
walker = new CKEDITOR.dom.walker( walkerRange );
|
1220
|
+
|
1221
|
+
// tailBrGuard only used for on range end.
|
1222
|
+
walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ?
|
1223
|
+
tailBrGuard : boundaryGuard;
|
1224
|
+
blockBoundary = null;
|
1225
|
+
// End the range right before the block boundary node.
|
1226
|
+
|
1227
|
+
enlargeable = walker.lastForward();
|
1228
|
+
|
1229
|
+
// It's the body which stop the enlarging if no block boundary found.
|
1230
|
+
blockBoundary = blockBoundary || body;
|
1231
|
+
|
1232
|
+
// Close the range either before the found block start (text]<p>...</p>) or at the block end (...text]</p>)
|
1233
|
+
// by comparing the document position with 'enlargeable' node.
|
1234
|
+
this.setEndAt(
|
1235
|
+
blockBoundary,
|
1236
|
+
( !enlargeable && this.checkEndOfBlock()
|
1237
|
+
|| enlargeable && blockBoundary.contains( enlargeable ) ) ?
|
1238
|
+
CKEDITOR.POSITION_BEFORE_END :
|
1239
|
+
CKEDITOR.POSITION_BEFORE_START );
|
1240
|
+
// We must include the <br> at the end of range if there's
|
1241
|
+
// one and we're expanding list item contents
|
1242
|
+
if ( tailBr )
|
1243
|
+
this.setEndAfter( tailBr );
|
1244
|
+
}
|
1245
|
+
},
|
1246
|
+
|
1247
|
+
/**
|
1248
|
+
* Descrease the range to make sure that boundaries
|
1249
|
+
* always anchor beside text nodes or innermost element.
|
1250
|
+
* @param {Number} mode ( CKEDITOR.SHRINK_ELEMENT | CKEDITOR.SHRINK_TEXT ) The shrinking mode.
|
1251
|
+
* <dl>
|
1252
|
+
* <dt>CKEDITOR.SHRINK_ELEMENT</dt>
|
1253
|
+
* <dd>Shrink the range boundaries to the edge of the innermost element.</dd>
|
1254
|
+
* <dt>CKEDITOR.SHRINK_TEXT</dt>
|
1255
|
+
* <dd>Shrink the range boudaries to anchor by the side of enclosed text node, range remains if there's no text nodes on boundaries at all.</dd>
|
1256
|
+
* </dl>
|
1257
|
+
* @param {Boolean} selectContents Whether result range anchors at the inner OR outer boundary of the node.
|
1258
|
+
*/
|
1259
|
+
shrink : function( mode, selectContents )
|
1260
|
+
{
|
1261
|
+
// Unable to shrink a collapsed range.
|
1262
|
+
if ( !this.collapsed )
|
1263
|
+
{
|
1264
|
+
mode = mode || CKEDITOR.SHRINK_TEXT;
|
1265
|
+
|
1266
|
+
var walkerRange = this.clone();
|
1267
|
+
|
1268
|
+
var startContainer = this.startContainer,
|
1269
|
+
endContainer = this.endContainer,
|
1270
|
+
startOffset = this.startOffset,
|
1271
|
+
endOffset = this.endOffset,
|
1272
|
+
collapsed = this.collapsed;
|
1273
|
+
|
1274
|
+
// Whether the start/end boundary is moveable.
|
1275
|
+
var moveStart = 1,
|
1276
|
+
moveEnd = 1;
|
1277
|
+
|
1278
|
+
if ( startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
|
1279
|
+
{
|
1280
|
+
if ( !startOffset )
|
1281
|
+
walkerRange.setStartBefore( startContainer );
|
1282
|
+
else if ( startOffset >= startContainer.getLength( ) )
|
1283
|
+
walkerRange.setStartAfter( startContainer );
|
1284
|
+
else
|
1285
|
+
{
|
1286
|
+
// Enlarge the range properly to avoid walker making
|
1287
|
+
// DOM changes caused by triming the text nodes later.
|
1288
|
+
walkerRange.setStartBefore( startContainer );
|
1289
|
+
moveStart = 0;
|
1290
|
+
}
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
if ( endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
|
1294
|
+
{
|
1295
|
+
if ( !endOffset )
|
1296
|
+
walkerRange.setEndBefore( endContainer );
|
1297
|
+
else if ( endOffset >= endContainer.getLength( ) )
|
1298
|
+
walkerRange.setEndAfter( endContainer );
|
1299
|
+
else
|
1300
|
+
{
|
1301
|
+
walkerRange.setEndAfter( endContainer );
|
1302
|
+
moveEnd = 0;
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
var walker = new CKEDITOR.dom.walker( walkerRange ),
|
1307
|
+
isBookmark = CKEDITOR.dom.walker.bookmark();
|
1308
|
+
|
1309
|
+
walker.evaluator = function( node )
|
1310
|
+
{
|
1311
|
+
return node.type == ( mode == CKEDITOR.SHRINK_ELEMENT ?
|
1312
|
+
CKEDITOR.NODE_ELEMENT : CKEDITOR.NODE_TEXT );
|
1313
|
+
};
|
1314
|
+
|
1315
|
+
var currentElement;
|
1316
|
+
walker.guard = function( node, movingOut )
|
1317
|
+
{
|
1318
|
+
if ( isBookmark( node ) )
|
1319
|
+
return true;
|
1320
|
+
|
1321
|
+
// Stop when we're shrink in element mode while encountering a text node.
|
1322
|
+
if ( mode == CKEDITOR.SHRINK_ELEMENT && node.type == CKEDITOR.NODE_TEXT )
|
1323
|
+
return false;
|
1324
|
+
|
1325
|
+
// Stop when we've already walked "through" an element.
|
1326
|
+
if ( movingOut && node.equals( currentElement ) )
|
1327
|
+
return false;
|
1328
|
+
|
1329
|
+
if ( !movingOut && node.type == CKEDITOR.NODE_ELEMENT )
|
1330
|
+
currentElement = node;
|
1331
|
+
|
1332
|
+
return true;
|
1333
|
+
};
|
1334
|
+
|
1335
|
+
if ( moveStart )
|
1336
|
+
{
|
1337
|
+
var textStart = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastForward' : 'next']();
|
1338
|
+
textStart && this.setStartAt( textStart, selectContents ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_START );
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
if ( moveEnd )
|
1342
|
+
{
|
1343
|
+
walker.reset();
|
1344
|
+
var textEnd = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastBackward' : 'previous']();
|
1345
|
+
textEnd && this.setEndAt( textEnd, selectContents ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_END );
|
1346
|
+
}
|
1347
|
+
|
1348
|
+
return !!( moveStart || moveEnd );
|
1349
|
+
}
|
1350
|
+
},
|
1351
|
+
|
1352
|
+
/**
|
1353
|
+
* Inserts a node at the start of the range. The range will be expanded
|
1354
|
+
* the contain the node.
|
1355
|
+
*/
|
1356
|
+
insertNode : function( node )
|
1357
|
+
{
|
1358
|
+
this.optimizeBookmark();
|
1359
|
+
this.trim( false, true );
|
1360
|
+
|
1361
|
+
var startContainer = this.startContainer;
|
1362
|
+
var startOffset = this.startOffset;
|
1363
|
+
|
1364
|
+
var nextNode = startContainer.getChild( startOffset );
|
1365
|
+
|
1366
|
+
if ( nextNode )
|
1367
|
+
node.insertBefore( nextNode );
|
1368
|
+
else
|
1369
|
+
startContainer.append( node );
|
1370
|
+
|
1371
|
+
// Check if we need to update the end boundary.
|
1372
|
+
if ( node.getParent().equals( this.endContainer ) )
|
1373
|
+
this.endOffset++;
|
1374
|
+
|
1375
|
+
// Expand the range to embrace the new node.
|
1376
|
+
this.setStartBefore( node );
|
1377
|
+
},
|
1378
|
+
|
1379
|
+
moveToPosition : function( node, position )
|
1380
|
+
{
|
1381
|
+
this.setStartAt( node, position );
|
1382
|
+
this.collapse( true );
|
1383
|
+
},
|
1384
|
+
|
1385
|
+
selectNodeContents : function( node )
|
1386
|
+
{
|
1387
|
+
this.setStart( node, 0 );
|
1388
|
+
this.setEnd( node, node.type == CKEDITOR.NODE_TEXT ? node.getLength() : node.getChildCount() );
|
1389
|
+
},
|
1390
|
+
|
1391
|
+
/**
|
1392
|
+
* Sets the start position of a Range.
|
1393
|
+
* @param {CKEDITOR.dom.node} startNode The node to start the range.
|
1394
|
+
* @param {Number} startOffset An integer greater than or equal to zero
|
1395
|
+
* representing the offset for the start of the range from the start
|
1396
|
+
* of startNode.
|
1397
|
+
*/
|
1398
|
+
setStart : function( startNode, startOffset )
|
1399
|
+
{
|
1400
|
+
// W3C requires a check for the new position. If it is after the end
|
1401
|
+
// boundary, the range should be collapsed to the new start. It seams
|
1402
|
+
// we will not need this check for our use of this class so we can
|
1403
|
+
// ignore it for now.
|
1404
|
+
|
1405
|
+
// Fixing invalid range start inside dtd empty elements.
|
1406
|
+
if( startNode.type == CKEDITOR.NODE_ELEMENT
|
1407
|
+
&& CKEDITOR.dtd.$empty[ startNode.getName() ] )
|
1408
|
+
startNode = startNode.getParent(), startOffset = startNode.getIndex();
|
1409
|
+
|
1410
|
+
this.startContainer = startNode;
|
1411
|
+
this.startOffset = startOffset;
|
1412
|
+
|
1413
|
+
if ( !this.endContainer )
|
1414
|
+
{
|
1415
|
+
this.endContainer = startNode;
|
1416
|
+
this.endOffset = startOffset;
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
updateCollapsed( this );
|
1420
|
+
},
|
1421
|
+
|
1422
|
+
/**
|
1423
|
+
* Sets the end position of a Range.
|
1424
|
+
* @param {CKEDITOR.dom.node} endNode The node to end the range.
|
1425
|
+
* @param {Number} endOffset An integer greater than or equal to zero
|
1426
|
+
* representing the offset for the end of the range from the start
|
1427
|
+
* of endNode.
|
1428
|
+
*/
|
1429
|
+
setEnd : function( endNode, endOffset )
|
1430
|
+
{
|
1431
|
+
// W3C requires a check for the new position. If it is before the start
|
1432
|
+
// boundary, the range should be collapsed to the new end. It seams we
|
1433
|
+
// will not need this check for our use of this class so we can ignore
|
1434
|
+
// it for now.
|
1435
|
+
|
1436
|
+
// Fixing invalid range end inside dtd empty elements.
|
1437
|
+
if( endNode.type == CKEDITOR.NODE_ELEMENT
|
1438
|
+
&& CKEDITOR.dtd.$empty[ endNode.getName() ] )
|
1439
|
+
endOffset = endNode.getIndex() + 1, endNode = endNode.getParent();
|
1440
|
+
|
1441
|
+
this.endContainer = endNode;
|
1442
|
+
this.endOffset = endOffset;
|
1443
|
+
|
1444
|
+
if ( !this.startContainer )
|
1445
|
+
{
|
1446
|
+
this.startContainer = endNode;
|
1447
|
+
this.startOffset = endOffset;
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
updateCollapsed( this );
|
1451
|
+
},
|
1452
|
+
|
1453
|
+
setStartAfter : function( node )
|
1454
|
+
{
|
1455
|
+
this.setStart( node.getParent(), node.getIndex() + 1 );
|
1456
|
+
},
|
1457
|
+
|
1458
|
+
setStartBefore : function( node )
|
1459
|
+
{
|
1460
|
+
this.setStart( node.getParent(), node.getIndex() );
|
1461
|
+
},
|
1462
|
+
|
1463
|
+
setEndAfter : function( node )
|
1464
|
+
{
|
1465
|
+
this.setEnd( node.getParent(), node.getIndex() + 1 );
|
1466
|
+
},
|
1467
|
+
|
1468
|
+
setEndBefore : function( node )
|
1469
|
+
{
|
1470
|
+
this.setEnd( node.getParent(), node.getIndex() );
|
1471
|
+
},
|
1472
|
+
|
1473
|
+
setStartAt : function( node, position )
|
1474
|
+
{
|
1475
|
+
switch( position )
|
1476
|
+
{
|
1477
|
+
case CKEDITOR.POSITION_AFTER_START :
|
1478
|
+
this.setStart( node, 0 );
|
1479
|
+
break;
|
1480
|
+
|
1481
|
+
case CKEDITOR.POSITION_BEFORE_END :
|
1482
|
+
if ( node.type == CKEDITOR.NODE_TEXT )
|
1483
|
+
this.setStart( node, node.getLength() );
|
1484
|
+
else
|
1485
|
+
this.setStart( node, node.getChildCount() );
|
1486
|
+
break;
|
1487
|
+
|
1488
|
+
case CKEDITOR.POSITION_BEFORE_START :
|
1489
|
+
this.setStartBefore( node );
|
1490
|
+
break;
|
1491
|
+
|
1492
|
+
case CKEDITOR.POSITION_AFTER_END :
|
1493
|
+
this.setStartAfter( node );
|
1494
|
+
}
|
1495
|
+
|
1496
|
+
updateCollapsed( this );
|
1497
|
+
},
|
1498
|
+
|
1499
|
+
setEndAt : function( node, position )
|
1500
|
+
{
|
1501
|
+
switch( position )
|
1502
|
+
{
|
1503
|
+
case CKEDITOR.POSITION_AFTER_START :
|
1504
|
+
this.setEnd( node, 0 );
|
1505
|
+
break;
|
1506
|
+
|
1507
|
+
case CKEDITOR.POSITION_BEFORE_END :
|
1508
|
+
if ( node.type == CKEDITOR.NODE_TEXT )
|
1509
|
+
this.setEnd( node, node.getLength() );
|
1510
|
+
else
|
1511
|
+
this.setEnd( node, node.getChildCount() );
|
1512
|
+
break;
|
1513
|
+
|
1514
|
+
case CKEDITOR.POSITION_BEFORE_START :
|
1515
|
+
this.setEndBefore( node );
|
1516
|
+
break;
|
1517
|
+
|
1518
|
+
case CKEDITOR.POSITION_AFTER_END :
|
1519
|
+
this.setEndAfter( node );
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
updateCollapsed( this );
|
1523
|
+
},
|
1524
|
+
|
1525
|
+
fixBlock : function( isStart, blockTag )
|
1526
|
+
{
|
1527
|
+
var bookmark = this.createBookmark(),
|
1528
|
+
fixedBlock = this.document.createElement( blockTag );
|
1529
|
+
|
1530
|
+
this.collapse( isStart );
|
1531
|
+
|
1532
|
+
this.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );
|
1533
|
+
|
1534
|
+
this.extractContents().appendTo( fixedBlock );
|
1535
|
+
fixedBlock.trim();
|
1536
|
+
|
1537
|
+
if ( !CKEDITOR.env.ie )
|
1538
|
+
fixedBlock.appendBogus();
|
1539
|
+
|
1540
|
+
this.insertNode( fixedBlock );
|
1541
|
+
|
1542
|
+
this.moveToBookmark( bookmark );
|
1543
|
+
|
1544
|
+
return fixedBlock;
|
1545
|
+
},
|
1546
|
+
|
1547
|
+
splitBlock : function( blockTag )
|
1548
|
+
{
|
1549
|
+
var startPath = new CKEDITOR.dom.elementPath( this.startContainer ),
|
1550
|
+
endPath = new CKEDITOR.dom.elementPath( this.endContainer );
|
1551
|
+
|
1552
|
+
var startBlockLimit = startPath.blockLimit,
|
1553
|
+
endBlockLimit = endPath.blockLimit;
|
1554
|
+
|
1555
|
+
var startBlock = startPath.block,
|
1556
|
+
endBlock = endPath.block;
|
1557
|
+
|
1558
|
+
var elementPath = null;
|
1559
|
+
// Do nothing if the boundaries are in different block limits.
|
1560
|
+
if ( !startBlockLimit.equals( endBlockLimit ) )
|
1561
|
+
return null;
|
1562
|
+
|
1563
|
+
// Get or fix current blocks.
|
1564
|
+
if ( blockTag != 'br' )
|
1565
|
+
{
|
1566
|
+
if ( !startBlock )
|
1567
|
+
{
|
1568
|
+
startBlock = this.fixBlock( true, blockTag );
|
1569
|
+
endBlock = new CKEDITOR.dom.elementPath( this.endContainer ).block;
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
if ( !endBlock )
|
1573
|
+
endBlock = this.fixBlock( false, blockTag );
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
// Get the range position.
|
1577
|
+
var isStartOfBlock = startBlock && this.checkStartOfBlock(),
|
1578
|
+
isEndOfBlock = endBlock && this.checkEndOfBlock();
|
1579
|
+
|
1580
|
+
// Delete the current contents.
|
1581
|
+
// TODO: Why is 2.x doing CheckIsEmpty()?
|
1582
|
+
this.deleteContents();
|
1583
|
+
|
1584
|
+
if ( startBlock && startBlock.equals( endBlock ) )
|
1585
|
+
{
|
1586
|
+
if ( isEndOfBlock )
|
1587
|
+
{
|
1588
|
+
elementPath = new CKEDITOR.dom.elementPath( this.startContainer );
|
1589
|
+
this.moveToPosition( endBlock, CKEDITOR.POSITION_AFTER_END );
|
1590
|
+
endBlock = null;
|
1591
|
+
}
|
1592
|
+
else if ( isStartOfBlock )
|
1593
|
+
{
|
1594
|
+
elementPath = new CKEDITOR.dom.elementPath( this.startContainer );
|
1595
|
+
this.moveToPosition( startBlock, CKEDITOR.POSITION_BEFORE_START );
|
1596
|
+
startBlock = null;
|
1597
|
+
}
|
1598
|
+
else
|
1599
|
+
{
|
1600
|
+
endBlock = this.splitElement( startBlock );
|
1601
|
+
|
1602
|
+
// In Gecko, the last child node must be a bogus <br>.
|
1603
|
+
// Note: bogus <br> added under <ul> or <ol> would cause
|
1604
|
+
// lists to be incorrectly rendered.
|
1605
|
+
if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') )
|
1606
|
+
startBlock.appendBogus() ;
|
1607
|
+
}
|
1608
|
+
}
|
1609
|
+
|
1610
|
+
return {
|
1611
|
+
previousBlock : startBlock,
|
1612
|
+
nextBlock : endBlock,
|
1613
|
+
wasStartOfBlock : isStartOfBlock,
|
1614
|
+
wasEndOfBlock : isEndOfBlock,
|
1615
|
+
elementPath : elementPath
|
1616
|
+
};
|
1617
|
+
},
|
1618
|
+
|
1619
|
+
/**
|
1620
|
+
* Branch the specified element from the collapsed range position and
|
1621
|
+
* place the caret between the two result branches.
|
1622
|
+
* Note: The range must be collapsed and been enclosed by this element.
|
1623
|
+
* @param {CKEDITOR.dom.element} element
|
1624
|
+
* @return {CKEDITOR.dom.element} Root element of the new branch after the split.
|
1625
|
+
*/
|
1626
|
+
splitElement : function( toSplit )
|
1627
|
+
{
|
1628
|
+
if ( !this.collapsed )
|
1629
|
+
return null;
|
1630
|
+
|
1631
|
+
// Extract the contents of the block from the selection point to the end
|
1632
|
+
// of its contents.
|
1633
|
+
this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
|
1634
|
+
var documentFragment = this.extractContents();
|
1635
|
+
|
1636
|
+
// Duplicate the element after it.
|
1637
|
+
var clone = toSplit.clone( false );
|
1638
|
+
|
1639
|
+
// Place the extracted contents into the duplicated element.
|
1640
|
+
documentFragment.appendTo( clone );
|
1641
|
+
clone.insertAfter( toSplit );
|
1642
|
+
this.moveToPosition( toSplit, CKEDITOR.POSITION_AFTER_END );
|
1643
|
+
return clone;
|
1644
|
+
},
|
1645
|
+
|
1646
|
+
/**
|
1647
|
+
* Check whether a range boundary is at the inner boundary of a given
|
1648
|
+
* element.
|
1649
|
+
* @param {CKEDITOR.dom.element} element The target element to check.
|
1650
|
+
* @param {Number} checkType The boundary to check for both the range
|
1651
|
+
* and the element. It can be CKEDITOR.START or CKEDITOR.END.
|
1652
|
+
* @returns {Boolean} "true" if the range boundary is at the inner
|
1653
|
+
* boundary of the element.
|
1654
|
+
*/
|
1655
|
+
checkBoundaryOfElement : function( element, checkType )
|
1656
|
+
{
|
1657
|
+
var checkStart = ( checkType == CKEDITOR.START );
|
1658
|
+
|
1659
|
+
// Create a copy of this range, so we can manipulate it for our checks.
|
1660
|
+
var walkerRange = this.clone();
|
1661
|
+
|
1662
|
+
// Collapse the range at the proper size.
|
1663
|
+
walkerRange.collapse( checkStart );
|
1664
|
+
|
1665
|
+
// Expand the range to element boundary.
|
1666
|
+
walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ]
|
1667
|
+
( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END );
|
1668
|
+
|
1669
|
+
// Create the walker, which will check if we have anything useful
|
1670
|
+
// in the range.
|
1671
|
+
var walker = new CKEDITOR.dom.walker( walkerRange );
|
1672
|
+
walker.evaluator = elementBoundaryEval;
|
1673
|
+
|
1674
|
+
return walker[ checkStart ? 'checkBackward' : 'checkForward' ]();
|
1675
|
+
},
|
1676
|
+
|
1677
|
+
// Calls to this function may produce changes to the DOM. The range may
|
1678
|
+
// be updated to reflect such changes.
|
1679
|
+
checkStartOfBlock : function()
|
1680
|
+
{
|
1681
|
+
var startContainer = this.startContainer,
|
1682
|
+
startOffset = this.startOffset;
|
1683
|
+
|
1684
|
+
// If the starting node is a text node, and non-empty before the offset,
|
1685
|
+
// then we're surely not at the start of block.
|
1686
|
+
if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
|
1687
|
+
{
|
1688
|
+
var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
|
1689
|
+
if ( textBefore.length )
|
1690
|
+
return false;
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
// Antecipate the trim() call here, so the walker will not make
|
1694
|
+
// changes to the DOM, which would not get reflected into this
|
1695
|
+
// range otherwise.
|
1696
|
+
this.trim();
|
1697
|
+
|
1698
|
+
// We need to grab the block element holding the start boundary, so
|
1699
|
+
// let's use an element path for it.
|
1700
|
+
var path = new CKEDITOR.dom.elementPath( this.startContainer );
|
1701
|
+
|
1702
|
+
// Creates a range starting at the block start until the range start.
|
1703
|
+
var walkerRange = this.clone();
|
1704
|
+
walkerRange.collapse( true );
|
1705
|
+
walkerRange.setStartAt( path.block || path.blockLimit, CKEDITOR.POSITION_AFTER_START );
|
1706
|
+
|
1707
|
+
var walker = new CKEDITOR.dom.walker( walkerRange );
|
1708
|
+
walker.evaluator = getCheckStartEndBlockEvalFunction( true );
|
1709
|
+
|
1710
|
+
return walker.checkBackward();
|
1711
|
+
},
|
1712
|
+
|
1713
|
+
checkEndOfBlock : function()
|
1714
|
+
{
|
1715
|
+
var endContainer = this.endContainer,
|
1716
|
+
endOffset = this.endOffset;
|
1717
|
+
|
1718
|
+
// If the ending node is a text node, and non-empty after the offset,
|
1719
|
+
// then we're surely not at the end of block.
|
1720
|
+
if ( endContainer.type == CKEDITOR.NODE_TEXT )
|
1721
|
+
{
|
1722
|
+
var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) );
|
1723
|
+
if ( textAfter.length )
|
1724
|
+
return false;
|
1725
|
+
}
|
1726
|
+
|
1727
|
+
// Antecipate the trim() call here, so the walker will not make
|
1728
|
+
// changes to the DOM, which would not get reflected into this
|
1729
|
+
// range otherwise.
|
1730
|
+
this.trim();
|
1731
|
+
|
1732
|
+
// We need to grab the block element holding the start boundary, so
|
1733
|
+
// let's use an element path for it.
|
1734
|
+
var path = new CKEDITOR.dom.elementPath( this.endContainer );
|
1735
|
+
|
1736
|
+
// Creates a range starting at the block start until the range start.
|
1737
|
+
var walkerRange = this.clone();
|
1738
|
+
walkerRange.collapse( false );
|
1739
|
+
walkerRange.setEndAt( path.block || path.blockLimit, CKEDITOR.POSITION_BEFORE_END );
|
1740
|
+
|
1741
|
+
var walker = new CKEDITOR.dom.walker( walkerRange );
|
1742
|
+
walker.evaluator = getCheckStartEndBlockEvalFunction( false );
|
1743
|
+
|
1744
|
+
return walker.checkForward();
|
1745
|
+
},
|
1746
|
+
|
1747
|
+
/**
|
1748
|
+
* Moves the range boundaries to the first/end editing point inside an
|
1749
|
+
* element. For example, in an element tree like
|
1750
|
+
* "<p><b><i></i></b> Text</p>", the start editing point is
|
1751
|
+
* "<p><b><i>^</i></b> Text</p>" (inside <i>).
|
1752
|
+
* @param {CKEDITOR.dom.element} el The element into which look for the
|
1753
|
+
* editing spot.
|
1754
|
+
* @param {Boolean} isMoveToEnd Whether move to the end editable position.
|
1755
|
+
*/
|
1756
|
+
moveToElementEditablePosition : function( el, isMoveToEnd )
|
1757
|
+
{
|
1758
|
+
var isEditable;
|
1759
|
+
|
1760
|
+
// Empty elements are rejected.
|
1761
|
+
if ( CKEDITOR.dtd.$empty[ el.getName() ] )
|
1762
|
+
return false;
|
1763
|
+
|
1764
|
+
while ( el && el.type == CKEDITOR.NODE_ELEMENT )
|
1765
|
+
{
|
1766
|
+
isEditable = el.isEditable();
|
1767
|
+
|
1768
|
+
// If an editable element is found, move inside it.
|
1769
|
+
if ( isEditable )
|
1770
|
+
this.moveToPosition( el, isMoveToEnd ?
|
1771
|
+
CKEDITOR.POSITION_BEFORE_END :
|
1772
|
+
CKEDITOR.POSITION_AFTER_START );
|
1773
|
+
// Stop immediately if we've found a non editable inline element (e.g <img>).
|
1774
|
+
else if ( CKEDITOR.dtd.$inline[ el.getName() ] )
|
1775
|
+
{
|
1776
|
+
this.moveToPosition( el, isMoveToEnd ?
|
1777
|
+
CKEDITOR.POSITION_AFTER_END :
|
1778
|
+
CKEDITOR.POSITION_BEFORE_START );
|
1779
|
+
return true;
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
// Non-editable non-inline elements are to be bypassed, getting the next one.
|
1783
|
+
if ( CKEDITOR.dtd.$empty[ el.getName() ] )
|
1784
|
+
el = el[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval );
|
1785
|
+
else
|
1786
|
+
el = el[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval );
|
1787
|
+
|
1788
|
+
// Stop immediately if we've found a text node.
|
1789
|
+
if ( el && el.type == CKEDITOR.NODE_TEXT )
|
1790
|
+
{
|
1791
|
+
this.moveToPosition( el, isMoveToEnd ?
|
1792
|
+
CKEDITOR.POSITION_AFTER_END :
|
1793
|
+
CKEDITOR.POSITION_BEFORE_START );
|
1794
|
+
return true;
|
1795
|
+
}
|
1796
|
+
}
|
1797
|
+
|
1798
|
+
return isEditable;
|
1799
|
+
},
|
1800
|
+
|
1801
|
+
/**
|
1802
|
+
*@see {CKEDITOR.dom.range.moveToElementEditablePosition}
|
1803
|
+
*/
|
1804
|
+
moveToElementEditStart : function( target )
|
1805
|
+
{
|
1806
|
+
return this.moveToElementEditablePosition( target );
|
1807
|
+
},
|
1808
|
+
|
1809
|
+
/**
|
1810
|
+
*@see {CKEDITOR.dom.range.moveToElementEditablePosition}
|
1811
|
+
*/
|
1812
|
+
moveToElementEditEnd : function( target )
|
1813
|
+
{
|
1814
|
+
return this.moveToElementEditablePosition( target, true );
|
1815
|
+
},
|
1816
|
+
|
1817
|
+
/**
|
1818
|
+
* Get the single node enclosed within the range if there's one.
|
1819
|
+
*/
|
1820
|
+
getEnclosedNode : function()
|
1821
|
+
{
|
1822
|
+
var walkerRange = this.clone();
|
1823
|
+
|
1824
|
+
// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)
|
1825
|
+
walkerRange.optimize();
|
1826
|
+
if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT
|
1827
|
+
|| walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
|
1828
|
+
return null;
|
1829
|
+
|
1830
|
+
var walker = new CKEDITOR.dom.walker( walkerRange ),
|
1831
|
+
isNotBookmarks = CKEDITOR.dom.walker.bookmark( true ),
|
1832
|
+
isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
|
1833
|
+
evaluator = function( node )
|
1834
|
+
{
|
1835
|
+
return isNotWhitespaces( node ) && isNotBookmarks( node );
|
1836
|
+
};
|
1837
|
+
walkerRange.evaluator = evaluator;
|
1838
|
+
var node = walker.next();
|
1839
|
+
walker.reset();
|
1840
|
+
return node && node.equals( walker.previous() ) ? node : null;
|
1841
|
+
},
|
1842
|
+
|
1843
|
+
getTouchedStartNode : function()
|
1844
|
+
{
|
1845
|
+
var container = this.startContainer ;
|
1846
|
+
|
1847
|
+
if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT )
|
1848
|
+
return container ;
|
1849
|
+
|
1850
|
+
return container.getChild( this.startOffset ) || container ;
|
1851
|
+
},
|
1852
|
+
|
1853
|
+
getTouchedEndNode : function()
|
1854
|
+
{
|
1855
|
+
var container = this.endContainer ;
|
1856
|
+
|
1857
|
+
if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT )
|
1858
|
+
return container ;
|
1859
|
+
|
1860
|
+
return container.getChild( this.endOffset - 1 ) || container ;
|
1861
|
+
}
|
1862
|
+
};
|
1863
|
+
})();
|
1864
|
+
|
1865
|
+
CKEDITOR.POSITION_AFTER_START = 1; // <element>^contents</element> "^text"
|
1866
|
+
CKEDITOR.POSITION_BEFORE_END = 2; // <element>contents^</element> "text^"
|
1867
|
+
CKEDITOR.POSITION_BEFORE_START = 3; // ^<element>contents</element> ^"text"
|
1868
|
+
CKEDITOR.POSITION_AFTER_END = 4; // <element>contents</element>^ "text"
|
1869
|
+
|
1870
|
+
CKEDITOR.ENLARGE_ELEMENT = 1;
|
1871
|
+
CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2;
|
1872
|
+
CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3;
|
1873
|
+
|
1874
|
+
// Check boundary types.
|
1875
|
+
// @see CKEDITOR.dom.range.prototype.checkBoundaryOfElement
|
1876
|
+
CKEDITOR.START = 1;
|
1877
|
+
CKEDITOR.END = 2;
|
1878
|
+
CKEDITOR.STARTEND = 3;
|
1879
|
+
|
1880
|
+
// Shrink range types.
|
1881
|
+
// @see CKEDITOR.dom.range.prototype.shrink
|
1882
|
+
CKEDITOR.SHRINK_ELEMENT = 1;
|
1883
|
+
CKEDITOR.SHRINK_TEXT = 2;
|