glebtv-ckeditor 4.5.10.3 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ckeditor/config.js.erb +1 -1
- data/lib/ckeditor.rb +1 -0
- data/lib/ckeditor/version.rb +2 -2
- data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +1 -1
- data/vendor/assets/javascripts/ckeditor/LICENSE.md +2 -2
- data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +1 -1
- data/vendor/assets/javascripts/ckeditor/build-config.js +26 -26
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +605 -576
- data/vendor/assets/javascripts/ckeditor/lang/en.js +2 -2
- data/vendor/assets/javascripts/ckeditor/lang/ru.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/css/styles.css +9 -0
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/dialogs/ckcss.js +2 -1
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/plugin.js +3 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +3 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/LICENSE.md +21 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.ckeditor.css +183 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.css +341 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/comment.js +206 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.css +32 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +202 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js +122 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/comment-fold.js +59 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldcode.js +150 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.css +20 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/autoFormatAll.js +43 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/formatting.js +226 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/javascript-hint.js +155 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/show-hint.css +36 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/show-hint.js +438 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/sql-hint.js +271 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex_test.js +33 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/simple.js +213 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/jump-to-line.js +49 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/match-highlighter.js +165 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/search.js +252 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/active-line.js +74 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify-html.js +952 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.js +2087 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.js +9109 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/bbcode.js +137 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/index.html +73 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/bbcodemixed.js +161 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/index.html +128 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/clike.js +785 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/index.html +360 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/scala.html +767 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/test.js +55 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/css.js +825 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss.html +103 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss_test.js +17 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/index.html +75 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less.html +152 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less_test.js +54 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss.html +157 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss_test.js +110 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/test.js +200 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/index.html +60 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/htmlmixed.js +152 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/index.html +89 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/index.html +114 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/javascript.js +784 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/json-ld.html +72 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/test.js +247 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/typescript.html +61 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/index.html +64 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/php.js +234 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/test.js +154 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/index.html +61 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/test.js +51 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/xml.js +394 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +30 -24
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +35 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +36 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +85 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +0 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +21 -15
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +9 -9
- data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +12 -12
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +11 -11
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +28 -28
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/LICENSE +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/README.md +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/LANG.js +3 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/en.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/readme.txt +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +25 -23
- data/vendor/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +40 -29
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +19 -19
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +20 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +85 -0
- data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/css/wordcount.css +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +60 -13
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcount.html +61 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcountWithMaxCount.html +110 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +9 -9
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/skins/moono-lisa/wsc.css +43 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +15 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/en.js +3 -1
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +448 -388
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons16.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons16.svg +175 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons32.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons32.svg +167 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/locations.json +145 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/arrow.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/spinner.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +46 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +7 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +2 -2
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/anchor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/images/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +3 -3
- data/vendor/assets/javascripts/ckeditor/styles.js +42 -16
- metadata +161 -105
- data/app/assets/javascripts/ckeditor/config_orig.js +0 -58
- data/vendor/assets/javascripts/ckeditor/README.md +0 -39
- data/vendor/assets/javascripts/ckeditor/config.js +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/af.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ar.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bg.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bn.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bs.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ca.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/cs.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/cy.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/da.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/de.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/el.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-au.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-ca.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-gb.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/eo.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/es.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/et.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/eu.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fa.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fi.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fo.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fr-ca.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fr.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/gl.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/gu.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/he.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hi.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hr.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hu.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/is.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/it.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ja.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ka.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/km.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ko.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ku.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/lt.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/lv.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/mk.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/mn.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ms.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/nb.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/nl.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/no.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pl.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pt-br.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pt.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ro.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sk.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sl.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sr-latn.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sr.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sv.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/th.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/tr.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ug.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/uk.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/vi.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/zh-cn.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/zh.js +0 -12
@@ -0,0 +1,155 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
var Pos = CodeMirror.Pos;
|
13
|
+
|
14
|
+
function forEach(arr, f) {
|
15
|
+
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
16
|
+
}
|
17
|
+
|
18
|
+
function arrayContains(arr, item) {
|
19
|
+
if (!Array.prototype.indexOf) {
|
20
|
+
var i = arr.length;
|
21
|
+
while (i--) {
|
22
|
+
if (arr[i] === item) {
|
23
|
+
return true;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
return arr.indexOf(item) != -1;
|
29
|
+
}
|
30
|
+
|
31
|
+
function scriptHint(editor, keywords, getToken, options) {
|
32
|
+
// Find the token at the cursor
|
33
|
+
var cur = editor.getCursor(), token = getToken(editor, cur);
|
34
|
+
if (/\b(?:string|comment)\b/.test(token.type)) return;
|
35
|
+
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
|
36
|
+
|
37
|
+
// If it's not a 'word-style' token, ignore the token.
|
38
|
+
if (!/^[\w$_]*$/.test(token.string)) {
|
39
|
+
token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
40
|
+
type: token.string == "." ? "property" : null};
|
41
|
+
} else if (token.end > cur.ch) {
|
42
|
+
token.end = cur.ch;
|
43
|
+
token.string = token.string.slice(0, cur.ch - token.start);
|
44
|
+
}
|
45
|
+
|
46
|
+
var tprop = token;
|
47
|
+
// If it is a property, find out what it is a property of.
|
48
|
+
while (tprop.type == "property") {
|
49
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
50
|
+
if (tprop.string != ".") return;
|
51
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
52
|
+
if (!context) var context = [];
|
53
|
+
context.push(tprop);
|
54
|
+
}
|
55
|
+
return {list: getCompletions(token, context, keywords, options),
|
56
|
+
from: Pos(cur.line, token.start),
|
57
|
+
to: Pos(cur.line, token.end)};
|
58
|
+
}
|
59
|
+
|
60
|
+
function javascriptHint(editor, options) {
|
61
|
+
return scriptHint(editor, javascriptKeywords,
|
62
|
+
function (e, cur) {return e.getTokenAt(cur);},
|
63
|
+
options);
|
64
|
+
};
|
65
|
+
CodeMirror.registerHelper("hint", "javascript", javascriptHint);
|
66
|
+
|
67
|
+
function getCoffeeScriptToken(editor, cur) {
|
68
|
+
// This getToken, it is for coffeescript, imitates the behavior of
|
69
|
+
// getTokenAt method in javascript.js, that is, returning "property"
|
70
|
+
// type and treat "." as indepenent token.
|
71
|
+
var token = editor.getTokenAt(cur);
|
72
|
+
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
|
73
|
+
token.end = token.start;
|
74
|
+
token.string = '.';
|
75
|
+
token.type = "property";
|
76
|
+
}
|
77
|
+
else if (/^\.[\w$_]*$/.test(token.string)) {
|
78
|
+
token.type = "property";
|
79
|
+
token.start++;
|
80
|
+
token.string = token.string.replace(/\./, '');
|
81
|
+
}
|
82
|
+
return token;
|
83
|
+
}
|
84
|
+
|
85
|
+
function coffeescriptHint(editor, options) {
|
86
|
+
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
|
87
|
+
}
|
88
|
+
CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
|
89
|
+
|
90
|
+
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
91
|
+
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
92
|
+
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
93
|
+
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
94
|
+
var funcProps = "prototype apply call bind".split(" ");
|
95
|
+
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
|
96
|
+
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
|
97
|
+
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
|
98
|
+
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
|
99
|
+
|
100
|
+
function forAllProps(obj, callback) {
|
101
|
+
if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
|
102
|
+
for (var name in obj) callback(name)
|
103
|
+
} else {
|
104
|
+
for (var o = obj; o; o = Object.getPrototypeOf(o))
|
105
|
+
Object.getOwnPropertyNames(o).forEach(callback)
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
function getCompletions(token, context, keywords, options) {
|
110
|
+
var found = [], start = token.string, global = options && options.globalScope || window;
|
111
|
+
function maybeAdd(str) {
|
112
|
+
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
|
113
|
+
}
|
114
|
+
function gatherCompletions(obj) {
|
115
|
+
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
116
|
+
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
117
|
+
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
118
|
+
forAllProps(obj, maybeAdd)
|
119
|
+
}
|
120
|
+
|
121
|
+
if (context && context.length) {
|
122
|
+
// If this is a property, see if it belongs to some object we can
|
123
|
+
// find in the current environment.
|
124
|
+
var obj = context.pop(), base;
|
125
|
+
if (obj.type && obj.type.indexOf("variable") === 0) {
|
126
|
+
if (options && options.additionalContext)
|
127
|
+
base = options.additionalContext[obj.string];
|
128
|
+
if (!options || options.useGlobalScope !== false)
|
129
|
+
base = base || global[obj.string];
|
130
|
+
} else if (obj.type == "string") {
|
131
|
+
base = "";
|
132
|
+
} else if (obj.type == "atom") {
|
133
|
+
base = 1;
|
134
|
+
} else if (obj.type == "function") {
|
135
|
+
if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
136
|
+
(typeof global.jQuery == 'function'))
|
137
|
+
base = global.jQuery();
|
138
|
+
else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
|
139
|
+
base = global._();
|
140
|
+
}
|
141
|
+
while (base != null && context.length)
|
142
|
+
base = base[context.pop().string];
|
143
|
+
if (base != null) gatherCompletions(base);
|
144
|
+
} else {
|
145
|
+
// If not, just look in the global object and any local scope
|
146
|
+
// (reading into JS mode internals to get at the local and global variables)
|
147
|
+
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
148
|
+
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
|
149
|
+
if (!options || options.useGlobalScope !== false)
|
150
|
+
gatherCompletions(global);
|
151
|
+
forEach(keywords, maybeAdd);
|
152
|
+
}
|
153
|
+
return found;
|
154
|
+
}
|
155
|
+
});
|
@@ -0,0 +1,36 @@
|
|
1
|
+
.CodeMirror-hints {
|
2
|
+
position: absolute;
|
3
|
+
z-index: 10;
|
4
|
+
overflow: hidden;
|
5
|
+
list-style: none;
|
6
|
+
|
7
|
+
margin: 0;
|
8
|
+
padding: 2px;
|
9
|
+
|
10
|
+
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
11
|
+
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
12
|
+
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
13
|
+
border-radius: 3px;
|
14
|
+
border: 1px solid silver;
|
15
|
+
|
16
|
+
background: white;
|
17
|
+
font-size: 90%;
|
18
|
+
font-family: monospace;
|
19
|
+
|
20
|
+
max-height: 20em;
|
21
|
+
overflow-y: auto;
|
22
|
+
}
|
23
|
+
|
24
|
+
.CodeMirror-hint {
|
25
|
+
margin: 0;
|
26
|
+
padding: 0 4px;
|
27
|
+
border-radius: 2px;
|
28
|
+
white-space: pre;
|
29
|
+
color: black;
|
30
|
+
cursor: pointer;
|
31
|
+
}
|
32
|
+
|
33
|
+
li.CodeMirror-hint-active {
|
34
|
+
background: #08f;
|
35
|
+
color: white;
|
36
|
+
}
|
@@ -0,0 +1,438 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
|
15
|
+
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
|
16
|
+
|
17
|
+
// This is the old interface, kept around for now to stay
|
18
|
+
// backwards-compatible.
|
19
|
+
CodeMirror.showHint = function(cm, getHints, options) {
|
20
|
+
if (!getHints) return cm.showHint(options);
|
21
|
+
if (options && options.async) getHints.async = true;
|
22
|
+
var newOpts = {hint: getHints};
|
23
|
+
if (options) for (var prop in options) newOpts[prop] = options[prop];
|
24
|
+
return cm.showHint(newOpts);
|
25
|
+
};
|
26
|
+
|
27
|
+
CodeMirror.defineExtension("showHint", function(options) {
|
28
|
+
options = parseOptions(this, this.getCursor("start"), options);
|
29
|
+
var selections = this.listSelections()
|
30
|
+
if (selections.length > 1) return;
|
31
|
+
// By default, don't allow completion when something is selected.
|
32
|
+
// A hint function can have a `supportsSelection` property to
|
33
|
+
// indicate that it can handle selections.
|
34
|
+
if (this.somethingSelected()) {
|
35
|
+
if (!options.hint.supportsSelection) return;
|
36
|
+
// Don't try with cross-line selections
|
37
|
+
for (var i = 0; i < selections.length; i++)
|
38
|
+
if (selections[i].head.line != selections[i].anchor.line) return;
|
39
|
+
}
|
40
|
+
|
41
|
+
if (this.state.completionActive) this.state.completionActive.close();
|
42
|
+
var completion = this.state.completionActive = new Completion(this, options);
|
43
|
+
if (!completion.options.hint) return;
|
44
|
+
|
45
|
+
CodeMirror.signal(this, "startCompletion", this);
|
46
|
+
completion.update(true);
|
47
|
+
});
|
48
|
+
|
49
|
+
function Completion(cm, options) {
|
50
|
+
this.cm = cm;
|
51
|
+
this.options = options;
|
52
|
+
this.widget = null;
|
53
|
+
this.debounce = 0;
|
54
|
+
this.tick = 0;
|
55
|
+
this.startPos = this.cm.getCursor("start");
|
56
|
+
this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
|
57
|
+
|
58
|
+
var self = this;
|
59
|
+
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
|
60
|
+
}
|
61
|
+
|
62
|
+
var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
|
63
|
+
return setTimeout(fn, 1000/60);
|
64
|
+
};
|
65
|
+
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
66
|
+
|
67
|
+
Completion.prototype = {
|
68
|
+
close: function() {
|
69
|
+
if (!this.active()) return;
|
70
|
+
this.cm.state.completionActive = null;
|
71
|
+
this.tick = null;
|
72
|
+
this.cm.off("cursorActivity", this.activityFunc);
|
73
|
+
|
74
|
+
if (this.widget && this.data) CodeMirror.signal(this.data, "close");
|
75
|
+
if (this.widget) this.widget.close();
|
76
|
+
CodeMirror.signal(this.cm, "endCompletion", this.cm);
|
77
|
+
},
|
78
|
+
|
79
|
+
active: function() {
|
80
|
+
return this.cm.state.completionActive == this;
|
81
|
+
},
|
82
|
+
|
83
|
+
pick: function(data, i) {
|
84
|
+
var completion = data.list[i];
|
85
|
+
if (completion.hint) completion.hint(this.cm, data, completion);
|
86
|
+
else this.cm.replaceRange(getText(completion), completion.from || data.from,
|
87
|
+
completion.to || data.to, "complete");
|
88
|
+
CodeMirror.signal(data, "pick", completion);
|
89
|
+
this.close();
|
90
|
+
},
|
91
|
+
|
92
|
+
cursorActivity: function() {
|
93
|
+
if (this.debounce) {
|
94
|
+
cancelAnimationFrame(this.debounce);
|
95
|
+
this.debounce = 0;
|
96
|
+
}
|
97
|
+
|
98
|
+
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
|
99
|
+
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
|
100
|
+
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
|
101
|
+
(pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
|
102
|
+
this.close();
|
103
|
+
} else {
|
104
|
+
var self = this;
|
105
|
+
this.debounce = requestAnimationFrame(function() {self.update();});
|
106
|
+
if (this.widget) this.widget.disable();
|
107
|
+
}
|
108
|
+
},
|
109
|
+
|
110
|
+
update: function(first) {
|
111
|
+
if (this.tick == null) return
|
112
|
+
var self = this, myTick = ++this.tick
|
113
|
+
fetchHints(this.options.hint, this.cm, this.options, function(data) {
|
114
|
+
if (self.tick == myTick) self.finishUpdate(data, first)
|
115
|
+
})
|
116
|
+
},
|
117
|
+
|
118
|
+
finishUpdate: function(data, first) {
|
119
|
+
if (this.data) CodeMirror.signal(this.data, "update");
|
120
|
+
|
121
|
+
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
122
|
+
if (this.widget) this.widget.close();
|
123
|
+
|
124
|
+
if (data && this.data && isNewCompletion(this.data, data)) return;
|
125
|
+
this.data = data;
|
126
|
+
|
127
|
+
if (data && data.list.length) {
|
128
|
+
if (picked && data.list.length == 1) {
|
129
|
+
this.pick(data, 0);
|
130
|
+
} else {
|
131
|
+
this.widget = new Widget(this, data);
|
132
|
+
CodeMirror.signal(data, "shown");
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
};
|
137
|
+
|
138
|
+
function isNewCompletion(old, nw) {
|
139
|
+
var moved = CodeMirror.cmpPos(nw.from, old.from)
|
140
|
+
return moved > 0 && old.to.ch - old.from.ch != nw.to.ch - nw.from.ch
|
141
|
+
}
|
142
|
+
|
143
|
+
function parseOptions(cm, pos, options) {
|
144
|
+
var editor = cm.options.hintOptions;
|
145
|
+
var out = {};
|
146
|
+
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
|
147
|
+
if (editor) for (var prop in editor)
|
148
|
+
if (editor[prop] !== undefined) out[prop] = editor[prop];
|
149
|
+
if (options) for (var prop in options)
|
150
|
+
if (options[prop] !== undefined) out[prop] = options[prop];
|
151
|
+
if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
|
152
|
+
return out;
|
153
|
+
}
|
154
|
+
|
155
|
+
function getText(completion) {
|
156
|
+
if (typeof completion == "string") return completion;
|
157
|
+
else return completion.text;
|
158
|
+
}
|
159
|
+
|
160
|
+
function buildKeyMap(completion, handle) {
|
161
|
+
var baseMap = {
|
162
|
+
Up: function() {handle.moveFocus(-1);},
|
163
|
+
Down: function() {handle.moveFocus(1);},
|
164
|
+
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
|
165
|
+
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
|
166
|
+
Home: function() {handle.setFocus(0);},
|
167
|
+
End: function() {handle.setFocus(handle.length - 1);},
|
168
|
+
Enter: handle.pick,
|
169
|
+
Tab: handle.pick,
|
170
|
+
Esc: handle.close
|
171
|
+
};
|
172
|
+
var custom = completion.options.customKeys;
|
173
|
+
var ourMap = custom ? {} : baseMap;
|
174
|
+
function addBinding(key, val) {
|
175
|
+
var bound;
|
176
|
+
if (typeof val != "string")
|
177
|
+
bound = function(cm) { return val(cm, handle); };
|
178
|
+
// This mechanism is deprecated
|
179
|
+
else if (baseMap.hasOwnProperty(val))
|
180
|
+
bound = baseMap[val];
|
181
|
+
else
|
182
|
+
bound = val;
|
183
|
+
ourMap[key] = bound;
|
184
|
+
}
|
185
|
+
if (custom)
|
186
|
+
for (var key in custom) if (custom.hasOwnProperty(key))
|
187
|
+
addBinding(key, custom[key]);
|
188
|
+
var extra = completion.options.extraKeys;
|
189
|
+
if (extra)
|
190
|
+
for (var key in extra) if (extra.hasOwnProperty(key))
|
191
|
+
addBinding(key, extra[key]);
|
192
|
+
return ourMap;
|
193
|
+
}
|
194
|
+
|
195
|
+
function getHintElement(hintsElement, el) {
|
196
|
+
while (el && el != hintsElement) {
|
197
|
+
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
|
198
|
+
el = el.parentNode;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
function Widget(completion, data) {
|
203
|
+
this.completion = completion;
|
204
|
+
this.data = data;
|
205
|
+
this.picked = false;
|
206
|
+
var widget = this, cm = completion.cm;
|
207
|
+
|
208
|
+
var hints = this.hints = document.createElement("ul");
|
209
|
+
hints.className = "CodeMirror-hints";
|
210
|
+
this.selectedHint = data.selectedHint || 0;
|
211
|
+
|
212
|
+
var completions = data.list;
|
213
|
+
for (var i = 0; i < completions.length; ++i) {
|
214
|
+
var elt = hints.appendChild(document.createElement("li")), cur = completions[i];
|
215
|
+
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
|
216
|
+
if (cur.className != null) className = cur.className + " " + className;
|
217
|
+
elt.className = className;
|
218
|
+
if (cur.render) cur.render(elt, data, cur);
|
219
|
+
else elt.appendChild(document.createTextNode(cur.displayText || getText(cur)));
|
220
|
+
elt.hintId = i;
|
221
|
+
}
|
222
|
+
|
223
|
+
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
|
224
|
+
var left = pos.left, top = pos.bottom, below = true;
|
225
|
+
hints.style.left = left + "px";
|
226
|
+
hints.style.top = top + "px";
|
227
|
+
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
228
|
+
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
|
229
|
+
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
|
230
|
+
(completion.options.container || document.body).appendChild(hints);
|
231
|
+
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
|
232
|
+
var scrolls = hints.scrollHeight > hints.clientHeight + 1
|
233
|
+
var startScroll = cm.getScrollInfo();
|
234
|
+
|
235
|
+
if (overlapY > 0) {
|
236
|
+
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
|
237
|
+
if (curTop - height > 0) { // Fits above cursor
|
238
|
+
hints.style.top = (top = pos.top - height) + "px";
|
239
|
+
below = false;
|
240
|
+
} else if (height > winH) {
|
241
|
+
hints.style.height = (winH - 5) + "px";
|
242
|
+
hints.style.top = (top = pos.bottom - box.top) + "px";
|
243
|
+
var cursor = cm.getCursor();
|
244
|
+
if (data.from.ch != cursor.ch) {
|
245
|
+
pos = cm.cursorCoords(cursor);
|
246
|
+
hints.style.left = (left = pos.left) + "px";
|
247
|
+
box = hints.getBoundingClientRect();
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
var overlapX = box.right - winW;
|
252
|
+
if (overlapX > 0) {
|
253
|
+
if (box.right - box.left > winW) {
|
254
|
+
hints.style.width = (winW - 5) + "px";
|
255
|
+
overlapX -= (box.right - box.left) - winW;
|
256
|
+
}
|
257
|
+
hints.style.left = (left = pos.left - overlapX) + "px";
|
258
|
+
}
|
259
|
+
if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
|
260
|
+
node.style.paddingRight = cm.display.nativeBarWidth + "px"
|
261
|
+
|
262
|
+
cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
|
263
|
+
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
|
264
|
+
setFocus: function(n) { widget.changeActive(n); },
|
265
|
+
menuSize: function() { return widget.screenAmount(); },
|
266
|
+
length: completions.length,
|
267
|
+
close: function() { completion.close(); },
|
268
|
+
pick: function() { widget.pick(); },
|
269
|
+
data: data
|
270
|
+
}));
|
271
|
+
|
272
|
+
if (completion.options.closeOnUnfocus) {
|
273
|
+
var closingOnBlur;
|
274
|
+
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
|
275
|
+
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
|
276
|
+
}
|
277
|
+
|
278
|
+
cm.on("scroll", this.onScroll = function() {
|
279
|
+
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
|
280
|
+
var newTop = top + startScroll.top - curScroll.top;
|
281
|
+
var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop);
|
282
|
+
if (!below) point += hints.offsetHeight;
|
283
|
+
if (point <= editor.top || point >= editor.bottom) return completion.close();
|
284
|
+
hints.style.top = newTop + "px";
|
285
|
+
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
|
286
|
+
});
|
287
|
+
|
288
|
+
CodeMirror.on(hints, "dblclick", function(e) {
|
289
|
+
var t = getHintElement(hints, e.target || e.srcElement);
|
290
|
+
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
|
291
|
+
});
|
292
|
+
|
293
|
+
CodeMirror.on(hints, "click", function(e) {
|
294
|
+
var t = getHintElement(hints, e.target || e.srcElement);
|
295
|
+
if (t && t.hintId != null) {
|
296
|
+
widget.changeActive(t.hintId);
|
297
|
+
if (completion.options.completeOnSingleClick) widget.pick();
|
298
|
+
}
|
299
|
+
});
|
300
|
+
|
301
|
+
CodeMirror.on(hints, "mousedown", function() {
|
302
|
+
setTimeout(function(){cm.focus();}, 20);
|
303
|
+
});
|
304
|
+
|
305
|
+
CodeMirror.signal(data, "select", completions[0], hints.firstChild);
|
306
|
+
return true;
|
307
|
+
}
|
308
|
+
|
309
|
+
Widget.prototype = {
|
310
|
+
close: function() {
|
311
|
+
if (this.completion.widget != this) return;
|
312
|
+
this.completion.widget = null;
|
313
|
+
this.hints.parentNode.removeChild(this.hints);
|
314
|
+
this.completion.cm.removeKeyMap(this.keyMap);
|
315
|
+
|
316
|
+
var cm = this.completion.cm;
|
317
|
+
if (this.completion.options.closeOnUnfocus) {
|
318
|
+
cm.off("blur", this.onBlur);
|
319
|
+
cm.off("focus", this.onFocus);
|
320
|
+
}
|
321
|
+
cm.off("scroll", this.onScroll);
|
322
|
+
},
|
323
|
+
|
324
|
+
disable: function() {
|
325
|
+
this.completion.cm.removeKeyMap(this.keyMap);
|
326
|
+
var widget = this;
|
327
|
+
this.keyMap = {Enter: function() { widget.picked = true; }};
|
328
|
+
this.completion.cm.addKeyMap(this.keyMap);
|
329
|
+
},
|
330
|
+
|
331
|
+
pick: function() {
|
332
|
+
this.completion.pick(this.data, this.selectedHint);
|
333
|
+
},
|
334
|
+
|
335
|
+
changeActive: function(i, avoidWrap) {
|
336
|
+
if (i >= this.data.list.length)
|
337
|
+
i = avoidWrap ? this.data.list.length - 1 : 0;
|
338
|
+
else if (i < 0)
|
339
|
+
i = avoidWrap ? 0 : this.data.list.length - 1;
|
340
|
+
if (this.selectedHint == i) return;
|
341
|
+
var node = this.hints.childNodes[this.selectedHint];
|
342
|
+
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
|
343
|
+
node = this.hints.childNodes[this.selectedHint = i];
|
344
|
+
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
|
345
|
+
if (node.offsetTop < this.hints.scrollTop)
|
346
|
+
this.hints.scrollTop = node.offsetTop - 3;
|
347
|
+
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
|
348
|
+
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
|
349
|
+
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
|
350
|
+
},
|
351
|
+
|
352
|
+
screenAmount: function() {
|
353
|
+
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
|
354
|
+
}
|
355
|
+
};
|
356
|
+
|
357
|
+
function applicableHelpers(cm, helpers) {
|
358
|
+
if (!cm.somethingSelected()) return helpers
|
359
|
+
var result = []
|
360
|
+
for (var i = 0; i < helpers.length; i++)
|
361
|
+
if (helpers[i].supportsSelection) result.push(helpers[i])
|
362
|
+
return result
|
363
|
+
}
|
364
|
+
|
365
|
+
function fetchHints(hint, cm, options, callback) {
|
366
|
+
if (hint.async) {
|
367
|
+
hint(cm, callback, options)
|
368
|
+
} else {
|
369
|
+
var result = hint(cm, options)
|
370
|
+
if (result && result.then) result.then(callback)
|
371
|
+
else callback(result)
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
function resolveAutoHints(cm, pos) {
|
376
|
+
var helpers = cm.getHelpers(pos, "hint"), words
|
377
|
+
if (helpers.length) {
|
378
|
+
var resolved = function(cm, callback, options) {
|
379
|
+
var app = applicableHelpers(cm, helpers);
|
380
|
+
function run(i) {
|
381
|
+
if (i == app.length) return callback(null)
|
382
|
+
fetchHints(app[i], cm, options, function(result) {
|
383
|
+
if (result && result.list.length > 0) callback(result)
|
384
|
+
else run(i + 1)
|
385
|
+
})
|
386
|
+
}
|
387
|
+
run(0)
|
388
|
+
}
|
389
|
+
resolved.async = true
|
390
|
+
resolved.supportsSelection = true
|
391
|
+
return resolved
|
392
|
+
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
|
393
|
+
return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
|
394
|
+
} else if (CodeMirror.hint.anyword) {
|
395
|
+
return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
|
396
|
+
} else {
|
397
|
+
return function() {}
|
398
|
+
}
|
399
|
+
}
|
400
|
+
|
401
|
+
CodeMirror.registerHelper("hint", "auto", {
|
402
|
+
resolve: resolveAutoHints
|
403
|
+
});
|
404
|
+
|
405
|
+
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
|
406
|
+
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
407
|
+
var to = CodeMirror.Pos(cur.line, token.end);
|
408
|
+
if (token.string && /\w/.test(token.string[token.string.length - 1])) {
|
409
|
+
var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
|
410
|
+
} else {
|
411
|
+
var term = "", from = to;
|
412
|
+
}
|
413
|
+
var found = [];
|
414
|
+
for (var i = 0; i < options.words.length; i++) {
|
415
|
+
var word = options.words[i];
|
416
|
+
if (word.slice(0, term.length) == term)
|
417
|
+
found.push(word);
|
418
|
+
}
|
419
|
+
|
420
|
+
if (found.length) return {list: found, from: from, to: to};
|
421
|
+
});
|
422
|
+
|
423
|
+
CodeMirror.commands.autocomplete = CodeMirror.showHint;
|
424
|
+
|
425
|
+
var defaultOptions = {
|
426
|
+
hint: CodeMirror.hint.auto,
|
427
|
+
completeSingle: true,
|
428
|
+
alignWithWord: true,
|
429
|
+
closeCharacters: /[\s()\[\]{};:>,]/,
|
430
|
+
closeOnUnfocus: true,
|
431
|
+
completeOnSingleClick: true,
|
432
|
+
container: null,
|
433
|
+
customKeys: null,
|
434
|
+
extraKeys: null
|
435
|
+
};
|
436
|
+
|
437
|
+
CodeMirror.defineOption("hintOptions", null);
|
438
|
+
});
|