@oat-sa/tao-core-ui 1.64.1 → 1.64.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +339 -339
- package/README.md +22 -22
- package/dist/actionbar.js +92 -92
- package/dist/adder.js +109 -109
- package/dist/animable/absorbable/absorbable.js +29 -29
- package/dist/animable/absorbable/css/absorb.css +7 -7
- package/dist/animable/absorbable/css/absorb.css.map +1 -1
- package/dist/animable/pulsable/css/pulse.css +7 -7
- package/dist/animable/pulsable/css/pulse.css.map +1 -1
- package/dist/animable/pulsable/pulsable.js +23 -23
- package/dist/areaBroker.js +51 -51
- package/dist/autocomplete/css/autocomplete.css +7 -7
- package/dist/autocomplete/css/autocomplete.css.map +1 -1
- package/dist/autocomplete.js +384 -384
- package/dist/autoscroll.js +22 -22
- package/dist/badge/badge.js +35 -35
- package/dist/badge/css/badge.css +7 -7
- package/dist/badge/css/badge.css.map +1 -1
- package/dist/breadcrumbs/css/breadcrumbs.css +7 -7
- package/dist/breadcrumbs/css/breadcrumbs.css.map +1 -1
- package/dist/breadcrumbs.js +57 -57
- package/dist/btngrouper.js +64 -64
- package/dist/bulkActionPopup/css/bulkActionPopup.css +7 -7
- package/dist/bulkActionPopup/css/bulkActionPopup.css.map +1 -1
- package/dist/bulkActionPopup.js +91 -91
- package/dist/button.js +89 -89
- package/dist/calculator/css/calculator.css +10 -10
- package/dist/calculator/css/calculator.css.map +1 -1
- package/dist/calculator.js +51 -51
- package/dist/cascadingComboBox.js +34 -34
- package/dist/ckeditor/ckConfigurator.js +49 -49
- package/dist/ckeditor/dtdHandler.js +110 -110
- package/dist/class/css/selector.css +7 -7
- package/dist/class/css/selector.css.map +1 -1
- package/dist/class/selector.js +98 -98
- package/dist/component/alignable.js +81 -81
- package/dist/component/containable.js +37 -37
- package/dist/component/css/components.css +7 -7
- package/dist/component/css/components.css.map +1 -1
- package/dist/component/css/windowComponent.css +7 -7
- package/dist/component/css/windowComponent.css.map +1 -1
- package/dist/component/draggable.js +25 -25
- package/dist/component/placeable.js +70 -70
- package/dist/component/resizable.js +61 -61
- package/dist/component/stackable.js +20 -20
- package/dist/component/windowed.js +46 -46
- package/dist/component.js +140 -140
- package/dist/container.js +76 -76
- package/dist/contextualPopup/css/contextualPopup.css +7 -7
- package/dist/contextualPopup/css/contextualPopup.css.map +1 -1
- package/dist/contextualPopup.js +100 -100
- package/dist/dashboard/css/dashboard.css +7 -7
- package/dist/dashboard/css/dashboard.css.map +1 -1
- package/dist/dashboard.js +62 -62
- package/dist/datalist/css/datalist.css +7 -7
- package/dist/datalist/css/datalist.css.map +1 -1
- package/dist/datalist.js +147 -147
- package/dist/datatable/css/datatable.css +7 -7
- package/dist/datatable/css/datatable.css.map +1 -1
- package/dist/datatable/filterStrategy/filterStrategy.js +27 -27
- package/dist/datatable/filterStrategy/multiple.js +25 -25
- package/dist/datatable/filterStrategy/single.js +25 -25
- package/dist/datatable.js +377 -377
- package/dist/dateRange/css/dateRange.css +7 -7
- package/dist/dateRange/css/dateRange.css.map +1 -1
- package/dist/dateRange/dateRange.js +97 -97
- package/dist/datetime/css/picker.css +7 -7
- package/dist/datetime/css/picker.css.map +1 -1
- package/dist/datetime/picker.js +161 -161
- package/dist/deleter.js +79 -79
- package/dist/destination/css/selector.css +7 -7
- package/dist/destination/css/selector.css.map +1 -1
- package/dist/destination/selector.js +52 -52
- package/dist/dialog/alert.js +26 -26
- package/dist/dialog/confirm.js +27 -27
- package/dist/dialog/confirmDelete.js +31 -31
- package/dist/dialog.js +141 -141
- package/dist/disabler.js +90 -90
- package/dist/documentViewer/css/documentViewer.css +7 -7
- package/dist/documentViewer/css/documentViewer.css.map +1 -1
- package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +30 -30
- package/dist/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +25 -25
- package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +120 -120
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +89 -89
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +52 -52
- package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +112 -112
- package/dist/documentViewer/providers/pdfViewer/pdfjs/textManager.js +67 -67
- package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +81 -81
- package/dist/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +111 -111
- package/dist/documentViewer/providers/pdfViewer.js +29 -29
- package/dist/documentViewer/viewerFactory.js +71 -71
- package/dist/documentViewer.js +86 -86
- package/dist/dropdown/css/dropdown.css +7 -7
- package/dist/dropdown/css/dropdown.css.map +1 -1
- package/dist/dropdown.js +84 -84
- package/dist/durationer.js +58 -58
- package/dist/dynamicComponent/css/dynamicComponent.css +7 -7
- package/dist/dynamicComponent/css/dynamicComponent.css.map +1 -1
- package/dist/dynamicComponent.js +103 -103
- package/dist/feedback.js +84 -84
- package/dist/figure/FigureStateActive.js +111 -111
- package/dist/filesender.js +26 -26
- package/dist/filter.js +34 -34
- package/dist/form/css/dropdownForm.css +7 -7
- package/dist/form/css/dropdownForm.css.map +1 -1
- package/dist/form/css/form.css +7 -7
- package/dist/form/css/form.css.map +1 -1
- package/dist/form/dropdownForm.js +99 -99
- package/dist/form/form.js +248 -248
- package/dist/form/simpleForm.js +71 -71
- package/dist/form/validator/css/validator.css +7 -7
- package/dist/form/validator/css/validator.css.map +1 -1
- package/dist/form/validator/renderer.js +52 -52
- package/dist/form/validator/validator.js +103 -103
- package/dist/form/widget/css/widget.css +7 -7
- package/dist/form/widget/css/widget.css.map +1 -1
- package/dist/form/widget/definitions.js +24 -24
- package/dist/form/widget/loader.js +16 -16
- package/dist/form/widget/providers/checkBox.js +62 -62
- package/dist/form/widget/providers/comboBox.js +46 -46
- package/dist/form/widget/providers/default.js +35 -35
- package/dist/form/widget/providers/hidden.js +37 -37
- package/dist/form/widget/providers/hiddenBox.js +58 -58
- package/dist/form/widget/providers/radioBox.js +57 -57
- package/dist/form/widget/providers/textArea.js +35 -35
- package/dist/form/widget/providers/textBox.js +34 -34
- package/dist/form/widget/widget.js +141 -141
- package/dist/form.js +10 -10
- package/dist/formValidator/formValidator.js +61 -61
- package/dist/formValidator/highlighters/highlighter.js +41 -41
- package/dist/formValidator/highlighters/message.js +29 -29
- package/dist/formValidator/highlighters/tooltip.js +32 -32
- package/dist/generis/form/css/form.css +7 -7
- package/dist/generis/form/css/form.css.map +1 -1
- package/dist/generis/form/form.js +73 -73
- package/dist/generis/validator/css/validator.css +7 -7
- package/dist/generis/validator/css/validator.css.map +1 -1
- package/dist/generis/validator/validator.js +38 -38
- package/dist/generis/widget/checkBox/checkBox.js +39 -39
- package/dist/generis/widget/comboBox/comboBox.js +32 -32
- package/dist/generis/widget/css/widget.css +7 -7
- package/dist/generis/widget/css/widget.css.map +1 -1
- package/dist/generis/widget/hiddenBox/hiddenBox.js +40 -40
- package/dist/generis/widget/loader.js +20 -20
- package/dist/generis/widget/textBox/textBox.js +27 -27
- package/dist/generis/widget/widget.js +47 -47
- package/dist/groupedComboBox.js +36 -36
- package/dist/groupvalidator.js +19 -19
- package/dist/hider.js +41 -41
- package/dist/highlighter.js +278 -278
- package/dist/image/ImgStateActive/extractLabel.js +20 -20
- package/dist/image/ImgStateActive/helper.js +16 -16
- package/dist/image/ImgStateActive/initHelper.js +85 -85
- package/dist/image/ImgStateActive/initMediaEditor.js +48 -48
- package/dist/image/ImgStateActive/mediaSizer.js +32 -32
- package/dist/image/ImgStateActive.js +104 -104
- package/dist/incrementer.js +58 -58
- package/dist/inplacer.js +87 -87
- package/dist/interactUtils.js +42 -42
- package/dist/itemButtonList/css/item-button-list.css +23 -23
- package/dist/itemButtonList/css/item-button-list.css.map +1 -1
- package/dist/itemButtonList.js +102 -102
- package/dist/keyNavigation/navigableDomElement.js +76 -76
- package/dist/keyNavigation/navigator.js +158 -158
- package/dist/listbox/css/listbox.css +7 -7
- package/dist/listbox/css/listbox.css.map +1 -1
- package/dist/listbox.js +84 -84
- package/dist/liststyler.js +57 -57
- package/dist/loadingButton/css/button.css +7 -7
- package/dist/loadingButton/css/button.css.map +1 -1
- package/dist/loadingButton/loadingButton.js +35 -35
- package/dist/lock.js +112 -112
- package/dist/login/login.js +87 -87
- package/dist/maths/calculator/basicCalculator.js +50 -50
- package/dist/maths/calculator/calculatorComponent.js +29 -29
- package/dist/maths/calculator/core/areaBroker.js +25 -25
- package/dist/maths/calculator/core/board.js +300 -300
- package/dist/maths/calculator/core/expression.js +98 -98
- package/dist/maths/calculator/core/labels.js +16 -16
- package/dist/maths/calculator/core/plugin.js +19 -19
- package/dist/maths/calculator/core/terms.js +26 -26
- package/dist/maths/calculator/core/tokenizer.js +98 -98
- package/dist/maths/calculator/core/tokens.js +75 -75
- package/dist/maths/calculator/css/calculator.css +7 -7
- package/dist/maths/calculator/css/calculator.css.map +1 -1
- package/dist/maths/calculator/defaultCalculator.js +23 -23
- package/dist/maths/calculator/plugins/core/degrad.js +22 -22
- package/dist/maths/calculator/plugins/core/history.js +45 -45
- package/dist/maths/calculator/plugins/core/remind.js +22 -22
- package/dist/maths/calculator/plugins/core/stepNavigation.js +31 -31
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +48 -48
- package/dist/maths/calculator/plugins/modifiers/pow10.js +35 -35
- package/dist/maths/calculator/plugins/modifiers/sign.js +90 -90
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +47 -47
- package/dist/maths/calculator/pluginsLoader.js +21 -21
- package/dist/maths/calculator/scientificCalculator.js +78 -78
- package/dist/mediaEditor/mediaEditorComponent.js +51 -51
- package/dist/mediaEditor/plugins/mediaAlignment/helper.js +16 -16
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +47 -47
- package/dist/mediaEditor/plugins/mediaAlignment/style.css +7 -7
- package/dist/mediaEditor/plugins/mediaDimension/helper.js +70 -70
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +140 -140
- package/dist/mediaEditor/plugins/mediaDimension/style.css +141 -141
- package/dist/mediaplayer/css/player.css +7 -7
- package/dist/mediaplayer/css/player.css.map +1 -1
- package/dist/mediaplayer/players/html5.js +52 -52
- package/dist/mediaplayer/players/youtube.js +39 -39
- package/dist/mediaplayer/players.js +18 -18
- package/dist/mediaplayer/support.js +55 -55
- package/dist/mediaplayer/utils/reminder.js +100 -100
- package/dist/mediaplayer/utils/timeObserver.js +92 -92
- package/dist/mediaplayer/youtubeManager.js +51 -51
- package/dist/mediaplayer.js +447 -447
- package/dist/mediasizer.js +122 -122
- package/dist/modal.js +87 -87
- package/dist/movableComponent.js +35 -35
- package/dist/pageSizeSelector.js +31 -31
- package/dist/pageStatus.js +33 -33
- package/dist/pagination/css/pagination.css +7 -7
- package/dist/pagination/css/pagination.css.map +1 -1
- package/dist/pagination/paginationStrategy.js +23 -23
- package/dist/pagination/providers/pages.js +24 -24
- package/dist/pagination/providers/simple.js +22 -22
- package/dist/pagination.js +45 -45
- package/dist/previewer.js +67 -67
- package/dist/progressbar.js +58 -58
- package/dist/propertySelector/css/propertySelector.css +7 -7
- package/dist/propertySelector/css/propertySelector.css.map +1 -1
- package/dist/propertySelector/propertySelector.js +86 -86
- package/dist/report.js +73 -73
- package/dist/resource/css/selector.css +7 -7
- package/dist/resource/css/selector.css.map +1 -1
- package/dist/resource/filters.js +60 -60
- package/dist/resource/list.js +53 -53
- package/dist/resource/selectable.js +92 -92
- package/dist/resource/selector.js +182 -182
- package/dist/resource/tree.js +91 -91
- package/dist/resourcemgr/css/resourcemgr.css +7 -7
- package/dist/resourcemgr/css/resourcemgr.css.map +1 -1
- package/dist/resourcemgr/fileBrowser.js +75 -75
- package/dist/resourcemgr/fileSelector.js +45 -45
- package/dist/resourcemgr/util/updatePermissions.js +4 -4
- package/dist/resourcemgr.js +49 -49
- package/dist/scroller.js +26 -26
- package/dist/searchModal/advancedSearch.js +155 -155
- package/dist/searchModal/css/advancedSearch.css +7 -7
- package/dist/searchModal/css/advancedSearch.css.map +1 -1
- package/dist/searchModal/css/searchModal.css +7 -7
- package/dist/searchModal/css/searchModal.css.map +1 -1
- package/dist/searchModal.js +134 -134
- package/dist/selecter.js +6 -6
- package/dist/stacker.js +43 -43
- package/dist/switch/css/switch.css +7 -7
- package/dist/switch/css/switch.css.map +1 -1
- package/dist/switch/switch.js +62 -62
- package/dist/tableModel.js +33 -33
- package/dist/tabs/css/tabs.css +12 -12
- package/dist/tabs/css/tabs.css.map +1 -1
- package/dist/tabs.js +220 -220
- package/dist/taskQueue/css/taskQueue.css +7 -7
- package/dist/taskQueue/css/taskQueue.css.map +1 -1
- package/dist/taskQueue/status.js +59 -59
- package/dist/taskQueue/table.js +54 -54
- package/dist/taskQueue/taskQueue.js +18 -18
- package/dist/taskQueue/taskQueueModel.js +102 -102
- package/dist/taskQueue.js +47 -47
- package/dist/taskQueueButton/css/taskable.css +7 -7
- package/dist/taskQueueButton/css/taskable.css.map +1 -1
- package/dist/taskQueueButton/css/treeButton.css +7 -7
- package/dist/taskQueueButton/css/treeButton.css.map +1 -1
- package/dist/taskQueueButton/standardButton.js +39 -39
- package/dist/taskQueueButton/taskable.js +41 -41
- package/dist/taskQueueButton/treeButton.js +43 -43
- package/dist/themeLoader.js +75 -75
- package/dist/themes.js +84 -84
- package/dist/toggler.js +57 -57
- package/dist/tooltip.js +41 -41
- package/dist/tooltipster.js +17 -17
- package/dist/transformer.js +117 -117
- package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css +7 -7
- package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +1 -1
- package/dist/tristateCheckboxGroup.js +62 -62
- package/dist/uploader.js +145 -145
- package/dist/validator/validators.js +48 -48
- package/dist/validator.js +23 -23
- package/dist/waitForMedia.js +33 -33
- package/dist/waitingDialog/css/waitingDialog.css +7 -7
- package/dist/waitingDialog/css/waitingDialog.css.map +1 -1
- package/dist/waitingDialog/waitingDialog.js +54 -54
- package/package.json +110 -110
- package/scss/basic.scss +16 -16
- package/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +60 -60
- package/scss/ckeditor/skins/tao/scss/inc/_tao.scss +59 -59
- package/scss/font/tao/tao.svg +235 -235
- package/scss/inc/_base.scss +495 -495
- package/scss/inc/_bootstrap.scss +6 -6
- package/scss/inc/_buttons.scss +114 -114
- package/scss/inc/_colors.scss +93 -93
- package/scss/inc/_feedback.scss +154 -154
- package/scss/inc/_flex-grid.scss +15 -15
- package/scss/inc/_fonts.scss +4 -4
- package/scss/inc/_forms.scss +832 -832
- package/scss/inc/_functions.scss +283 -283
- package/scss/inc/_jquery.nouislider.scss +254 -254
- package/scss/inc/_normalize.scss +528 -528
- package/scss/inc/_report.scss +67 -67
- package/scss/inc/_secondary-properties.scss +89 -89
- package/scss/inc/_select2.scss +634 -634
- package/scss/inc/_toolbars.scss +155 -155
- package/scss/inc/_tooltip.scss +312 -312
- package/scss/inc/_variables.scss +21 -21
- package/scss/inc/base/_highlight.scss +5 -5
- package/scss/inc/base/_list-style.scss +58 -58
- package/scss/inc/base/_svg.scss +3 -3
- package/scss/inc/base/_table.scss +62 -62
- package/scss/inc/fonts/_source-sans-pro.scss +29 -29
- package/scss/inc/fonts/_tao-icon-classes.scss +227 -227
- package/scss/inc/fonts/_tao-icon-def.scss +12 -12
- package/scss/inc/fonts/_tao-icon-vars.scss +241 -241
- package/src/actionbar/tpl/main.tpl +8 -8
- package/src/actionbar.js +251 -251
- package/src/adder.js +250 -250
- package/src/animable/absorbable/absorbable.js +134 -134
- package/src/animable/absorbable/css/absorb.css +7 -7
- package/src/animable/absorbable/css/absorb.css.map +1 -1
- package/src/animable/absorbable/scss/absorb.scss +37 -37
- package/src/animable/pulsable/css/pulse.css +7 -7
- package/src/animable/pulsable/css/pulse.css.map +1 -1
- package/src/animable/pulsable/pulsable.js +90 -90
- package/src/animable/pulsable/scss/pulse.scss +22 -22
- package/src/areaBroker.js +160 -160
- package/src/autocomplete/css/autocomplete.css +7 -7
- package/src/autocomplete/css/autocomplete.css.map +1 -1
- package/src/autocomplete/scss/autocomplete.scss +37 -37
- package/src/autocomplete.js +1027 -1027
- package/src/autoscroll.js +57 -57
- package/src/badge/badge.js +119 -119
- package/src/badge/css/badge.css +7 -7
- package/src/badge/css/badge.css.map +1 -1
- package/src/badge/scss/badge.scss +92 -92
- package/src/badge/tpl/badge.tpl +4 -4
- package/src/breadcrumbs/css/breadcrumbs.css +7 -7
- package/src/breadcrumbs/css/breadcrumbs.css.map +1 -1
- package/src/breadcrumbs/scss/breadcrumbs.scss +52 -52
- package/src/breadcrumbs/tpl/breadcrumbs.tpl +20 -20
- package/src/breadcrumbs.js +99 -99
- package/src/btngrouper.js +213 -213
- package/src/bulkActionPopup/css/bulkActionPopup.css +7 -7
- package/src/bulkActionPopup/css/bulkActionPopup.css.map +1 -1
- package/src/bulkActionPopup/scss/bulkActionPopup.scss +63 -63
- package/src/bulkActionPopup/tpl/layout.tpl +76 -76
- package/src/bulkActionPopup/tpl/select.tpl +8 -8
- package/src/bulkActionPopup.js +274 -274
- package/src/button/tpl/button.tpl +4 -4
- package/src/button.js +135 -135
- package/src/calculator/css/calculator.css +10 -10
- package/src/calculator/css/calculator.css.map +1 -1
- package/src/calculator/scss/calculator.scss +139 -139
- package/src/calculator.js +188 -188
- package/src/cascadingComboBox.js +126 -126
- package/src/ckeditor/ckConfigurator.js +742 -742
- package/src/ckeditor/dtdHandler.js +1030 -1030
- package/src/class/css/selector.css +7 -7
- package/src/class/css/selector.css.map +1 -1
- package/src/class/scss/selector.scss +101 -101
- package/src/class/selector.js +329 -329
- package/src/class/tpl/listItem.tpl +9 -9
- package/src/class/tpl/selector.tpl +10 -10
- package/src/component/alignable.js +274 -274
- package/src/component/containable.js +122 -122
- package/src/component/css/components.css +7 -7
- package/src/component/css/components.css.map +1 -1
- package/src/component/css/windowComponent.css +7 -7
- package/src/component/css/windowComponent.css.map +1 -1
- package/src/component/draggable.js +104 -104
- package/src/component/placeable.js +233 -233
- package/src/component/resizable.js +195 -195
- package/src/component/scss/components.scss +507 -507
- package/src/component/scss/windowComponent.scss +62 -62
- package/src/component/stackable.js +67 -67
- package/src/component/tpl/window.tpl +7 -7
- package/src/component/windowed.js +206 -206
- package/src/component.js +401 -401
- package/src/container.js +200 -200
- package/src/contextualPopup/css/contextualPopup.css +7 -7
- package/src/contextualPopup/css/contextualPopup.css.map +1 -1
- package/src/contextualPopup/scss/contextualPopup.scss +78 -78
- package/src/contextualPopup/tpl/popup.tpl +10 -10
- package/src/contextualPopup.js +294 -294
- package/src/css/basic.css +104 -104
- package/src/css/basic.css.map +1 -1
- package/src/dashboard/css/dashboard.css +7 -7
- package/src/dashboard/css/dashboard.css.map +1 -1
- package/src/dashboard/scss/dashboard.scss +93 -93
- package/src/dashboard/tpl/dashboard.tpl +16 -16
- package/src/dashboard/tpl/dashboardMetricsList.tpl +15 -15
- package/src/dashboard.js +179 -179
- package/src/datalist/css/datalist.css +7 -7
- package/src/datalist/css/datalist.css.map +1 -1
- package/src/datalist/scss/datalist.scss +116 -116
- package/src/datalist/tpl/list.tpl +24 -24
- package/src/datalist/tpl/main.tpl +44 -44
- package/src/datalist.js +500 -500
- package/src/datatable/css/datatable.css +7 -7
- package/src/datatable/css/datatable.css.map +1 -1
- package/src/datatable/filterStrategy/filterStrategy.js +70 -70
- package/src/datatable/filterStrategy/multiple.js +126 -126
- package/src/datatable/filterStrategy/single.js +108 -108
- package/src/datatable/scss/datatable.scss +149 -149
- package/src/datatable/tpl/button.tpl +6 -6
- package/src/datatable/tpl/layout.tpl +158 -158
- package/src/datatable.js +1056 -1056
- package/src/dateRange/css/dateRange.css +7 -7
- package/src/dateRange/css/dateRange.css.map +1 -1
- package/src/dateRange/dateRange.js +341 -341
- package/src/dateRange/scss/dateRange.scss +7 -7
- package/src/dateRange/tpl/select.tpl +18 -18
- package/src/datetime/css/picker.css +7 -7
- package/src/datetime/css/picker.css.map +1 -1
- package/src/datetime/picker.js +576 -576
- package/src/datetime/scss/picker.scss +192 -192
- package/src/datetime/tpl/picker.tpl +18 -18
- package/src/deleter/undo.tpl +6 -6
- package/src/deleter.js +296 -296
- package/src/destination/css/selector.css +7 -7
- package/src/destination/css/selector.css.map +1 -1
- package/src/destination/scss/selector.scss +36 -36
- package/src/destination/selector.js +195 -195
- package/src/destination/tpl/selector.tpl +13 -13
- package/src/dialog/alert.js +70 -70
- package/src/dialog/confirm.js +85 -85
- package/src/dialog/confirmDelete.js +95 -95
- package/src/dialog/tpl/body.tpl +24 -24
- package/src/dialog/tpl/buttons.tpl +6 -6
- package/src/dialog/tpl/checkbox.tpl +5 -5
- package/src/dialog.js +517 -517
- package/src/disabler.js +230 -230
- package/src/documentViewer/css/documentViewer.css +7 -7
- package/src/documentViewer/css/documentViewer.css.map +1 -1
- package/src/documentViewer/providers/pdfViewer/fallback/viewer.js +69 -69
- package/src/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +41 -41
- package/src/documentViewer/providers/pdfViewer/pdfjs/findBar.js +475 -475
- package/src/documentViewer/providers/pdfViewer/pdfjs/findBar.tpl +20 -20
- package/src/documentViewer/providers/pdfViewer/pdfjs/match.tpl +1 -1
- package/src/documentViewer/providers/pdfViewer/pdfjs/page.tpl +4 -4
- package/src/documentViewer/providers/pdfViewer/pdfjs/pageView.js +318 -318
- package/src/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +167 -167
- package/src/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +451 -451
- package/src/documentViewer/providers/pdfViewer/pdfjs/textManager.js +252 -252
- package/src/documentViewer/providers/pdfViewer/pdfjs/viewer.js +299 -299
- package/src/documentViewer/providers/pdfViewer/pdfjs/viewer.tpl +16 -16
- package/src/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +351 -351
- package/src/documentViewer/providers/pdfViewer.js +93 -93
- package/src/documentViewer/scss/documentViewer.scss +184 -184
- package/src/documentViewer/viewerFactory.js +191 -191
- package/src/documentViewer.js +238 -238
- package/src/dropdown/css/dropdown.css +7 -7
- package/src/dropdown/css/dropdown.css.map +1 -1
- package/src/dropdown/scss/dropdown.scss +99 -99
- package/src/dropdown/tpl/dropdown.tpl +8 -8
- package/src/dropdown/tpl/list-item.tpl +4 -4
- package/src/dropdown.js +255 -255
- package/src/durationer.js +220 -220
- package/src/dynamicComponent/css/dynamicComponent.css +7 -7
- package/src/dynamicComponent/css/dynamicComponent.css.map +1 -1
- package/src/dynamicComponent/scss/dynamicComponent.scss +98 -98
- package/src/dynamicComponent/tpl/layout.tpl +17 -17
- package/src/dynamicComponent.js +553 -553
- package/src/feedback/feedback.tpl +7 -7
- package/src/feedback.js +295 -295
- package/src/figure/FigureStateActive.js +184 -184
- package/src/filesender.js +112 -112
- package/src/filter/template.tpl +5 -5
- package/src/filter.js +129 -129
- package/src/form/css/dropdownForm.css +7 -7
- package/src/form/css/dropdownForm.css.map +1 -1
- package/src/form/css/form.css +7 -7
- package/src/form/css/form.css.map +1 -1
- package/src/form/dropdownForm.js +281 -281
- package/src/form/form.js +688 -688
- package/src/form/scss/dropdownForm.scss +60 -60
- package/src/form/scss/form.scss +25 -25
- package/src/form/simpleForm.js +125 -125
- package/src/form/tpl/dropdownForm.tpl +4 -4
- package/src/form/tpl/form.tpl +7 -7
- package/src/form/validator/css/validator.css +7 -7
- package/src/form/validator/css/validator.css.map +1 -1
- package/src/form/validator/renderer.js +118 -118
- package/src/form/validator/scss/validator.scss +14 -14
- package/src/form/validator/tpl/message.tpl +1 -1
- package/src/form/validator/tpl/validator.tpl +1 -1
- package/src/form/validator/validator.js +220 -220
- package/src/form/widget/css/widget.css +7 -7
- package/src/form/widget/css/widget.css.map +1 -1
- package/src/form/widget/definitions.js +51 -51
- package/src/form/widget/loader.js +40 -40
- package/src/form/widget/providers/checkBox.js +138 -138
- package/src/form/widget/providers/comboBox.js +63 -63
- package/src/form/widget/providers/default.js +90 -90
- package/src/form/widget/providers/hidden.js +62 -62
- package/src/form/widget/providers/hiddenBox.js +152 -152
- package/src/form/widget/providers/radioBox.js +99 -99
- package/src/form/widget/providers/textArea.js +52 -52
- package/src/form/widget/providers/textBox.js +48 -48
- package/src/form/widget/scss/widget.scss +55 -55
- package/src/form/widget/tpl/checkBox.tpl +25 -25
- package/src/form/widget/tpl/comboBox.tpl +13 -13
- package/src/form/widget/tpl/hidden.tpl +1 -1
- package/src/form/widget/tpl/hiddenBox.tpl +17 -17
- package/src/form/widget/tpl/label.tpl +6 -6
- package/src/form/widget/tpl/radioBox.tpl +25 -25
- package/src/form/widget/tpl/textArea.tpl +8 -8
- package/src/form/widget/tpl/widget.tpl +8 -8
- package/src/form/widget/widget.js +372 -372
- package/src/form.js +47 -47
- package/src/formValidator/formValidator.js +253 -253
- package/src/formValidator/highlighters/highlighter.js +103 -103
- package/src/formValidator/highlighters/message.js +68 -68
- package/src/formValidator/highlighters/tooltip.js +78 -78
- package/src/generis/form/css/form.css +7 -7
- package/src/generis/form/css/form.css.map +1 -1
- package/src/generis/form/form.js +239 -239
- package/src/generis/form/readme.md +70 -70
- package/src/generis/form/scss/form.scss +23 -23
- package/src/generis/form/tpl/form.tpl +16 -16
- package/src/generis/validator/css/validator.css +7 -7
- package/src/generis/validator/css/validator.css.map +1 -1
- package/src/generis/validator/readme.md +46 -46
- package/src/generis/validator/scss/validator.scss +13 -13
- package/src/generis/validator/validator.js +128 -128
- package/src/generis/widget/checkBox/checkBox.js +112 -112
- package/src/generis/widget/checkBox/checkBox.tpl +18 -18
- package/src/generis/widget/comboBox/comboBox.js +66 -66
- package/src/generis/widget/comboBox/comboBox.tpl +12 -12
- package/src/generis/widget/css/widget.css +7 -7
- package/src/generis/widget/css/widget.css.map +1 -1
- package/src/generis/widget/hiddenBox/hiddenBox.js +131 -131
- package/src/generis/widget/hiddenBox/hiddenBox.tpl +16 -16
- package/src/generis/widget/loader.js +49 -49
- package/src/generis/widget/readme.md +59 -59
- package/src/generis/widget/scss/widget.scss +61 -61
- package/src/generis/widget/textBox/textBox.js +64 -64
- package/src/generis/widget/textBox/textBox.tpl +7 -7
- package/src/generis/widget/widget.js +164 -164
- package/src/generis/widget/widget.tpl +5 -5
- package/src/groupedComboBox.js +99 -99
- package/src/groupvalidator.js +84 -84
- package/src/hider.js +88 -88
- package/src/highlighter.js +1192 -1192
- package/src/image/ImgStateActive/extractLabel.js +29 -29
- package/src/image/ImgStateActive/helper.js +36 -36
- package/src/image/ImgStateActive/initHelper.js +137 -137
- package/src/image/ImgStateActive/initMediaEditor.js +92 -92
- package/src/image/ImgStateActive/mediaSizer.js +63 -63
- package/src/image/ImgStateActive.js +115 -115
- package/src/incrementer.js +309 -309
- package/src/inplacer.js +315 -315
- package/src/interactUtils.js +140 -140
- package/src/itemButtonList/css/item-button-list.css +23 -23
- package/src/itemButtonList/css/item-button-list.css.map +1 -1
- package/src/itemButtonList/scss/item-button-list.scss +236 -236
- package/src/itemButtonList/tpl/itemButtonList.tpl +21 -21
- package/src/itemButtonList.js +274 -274
- package/src/keyNavigation/navigableDomElement.js +285 -285
- package/src/keyNavigation/navigator.js +535 -535
- package/src/listbox/css/listbox.css +7 -7
- package/src/listbox/css/listbox.css.map +1 -1
- package/src/listbox/scss/listbox.scss +116 -116
- package/src/listbox/tpl/list.tpl +14 -14
- package/src/listbox/tpl/main.tpl +9 -9
- package/src/listbox.js +252 -252
- package/src/liststyler.js +155 -155
- package/src/loadingButton/css/button.css +7 -7
- package/src/loadingButton/css/button.css.map +1 -1
- package/src/loadingButton/loadingButton.js +110 -110
- package/src/loadingButton/scss/button.scss +41 -41
- package/src/loadingButton/tpl/button.tpl +5 -5
- package/src/lock/lock.tpl +16 -16
- package/src/lock.js +393 -393
- package/src/login/login.js +317 -317
- package/src/login/tpl/login.tpl +29 -29
- package/src/login/tpl/passwordReveal.tpl +7 -7
- package/src/maths/calculator/basicCalculator.js +55 -55
- package/src/maths/calculator/calculatorComponent.js +128 -128
- package/src/maths/calculator/core/areaBroker.js +38 -38
- package/src/maths/calculator/core/board.js +841 -841
- package/src/maths/calculator/core/expression.js +430 -430
- package/src/maths/calculator/core/labels.js +116 -116
- package/src/maths/calculator/core/plugin.js +40 -40
- package/src/maths/calculator/core/terms.js +459 -459
- package/src/maths/calculator/core/tokenizer.js +245 -245
- package/src/maths/calculator/core/tokens.js +178 -178
- package/src/maths/calculator/core/tpl/board.tpl +4 -4
- package/src/maths/calculator/css/calculator.css +7 -7
- package/src/maths/calculator/css/calculator.css.map +1 -1
- package/src/maths/calculator/defaultCalculator.js +66 -66
- package/src/maths/calculator/plugins/core/degrad.js +90 -90
- package/src/maths/calculator/plugins/core/history.js +166 -166
- package/src/maths/calculator/plugins/core/remind.js +96 -96
- package/src/maths/calculator/plugins/core/stepNavigation.js +175 -175
- package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +36 -36
- package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +91 -91
- package/src/maths/calculator/plugins/modifiers/pow10.js +143 -143
- package/src/maths/calculator/plugins/modifiers/sign.js +339 -339
- package/src/maths/calculator/plugins/screen/simpleScreen/defaultTemplate.tpl +3 -3
- package/src/maths/calculator/plugins/screen/simpleScreen/history.tpl +3 -3
- package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +190 -190
- package/src/maths/calculator/pluginsLoader.js +46 -46
- package/src/maths/calculator/scientificCalculator.js +74 -74
- package/src/maths/calculator/scss/calculator.scss +396 -396
- package/src/maths/calculator/tpl/basicKeyboard.tpl +37 -37
- package/src/maths/calculator/tpl/basicScreen.tpl +2 -2
- package/src/maths/calculator/tpl/scientificKeyboard.tpl +61 -61
- package/src/maths/calculator/tpl/scientificScreen.tpl +3 -3
- package/src/mediaEditor/mediaEditorComponent.js +141 -141
- package/src/mediaEditor/plugins/mediaAlignment/helper.js +110 -110
- package/src/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +99 -99
- package/src/mediaEditor/plugins/mediaAlignment/style.css +7 -7
- package/src/mediaEditor/plugins/mediaAlignment/tpl/mediaAlignment.tpl +25 -25
- package/src/mediaEditor/plugins/mediaDimension/helper.js +190 -190
- package/src/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +561 -561
- package/src/mediaEditor/plugins/mediaDimension/style.css +141 -141
- package/src/mediaEditor/plugins/mediaDimension/tpl/mediaDimension.tpl +55 -55
- package/src/mediaEditor/tpl/editor.tpl +4 -4
- package/src/mediaplayer/css/player.css +7 -7
- package/src/mediaplayer/css/player.css.map +1 -1
- package/src/mediaplayer/players/html5.js +564 -564
- package/src/mediaplayer/players/youtube.js +323 -323
- package/src/mediaplayer/players.js +29 -29
- package/src/mediaplayer/readme.md +305 -305
- package/src/mediaplayer/scss/player.scss +569 -569
- package/src/mediaplayer/support.js +126 -126
- package/src/mediaplayer/tpl/audio.tpl +6 -6
- package/src/mediaplayer/tpl/player.tpl +37 -37
- package/src/mediaplayer/tpl/source.tpl +1 -1
- package/src/mediaplayer/tpl/video.tpl +6 -6
- package/src/mediaplayer/tpl/youtube.tpl +1 -1
- package/src/mediaplayer/utils/reminder.js +184 -184
- package/src/mediaplayer/utils/timeObserver.js +143 -143
- package/src/mediaplayer/youtubeManager.js +161 -161
- package/src/mediaplayer.js +1606 -1606
- package/src/mediasizer/mediasizer.tpl +55 -55
- package/src/mediasizer.js +635 -635
- package/src/modal.js +365 -365
- package/src/movableComponent.js +78 -78
- package/src/pageSizeSelector/tpl/pageSizeSelector.tpl +9 -9
- package/src/pageSizeSelector.js +106 -106
- package/src/pageStatus.js +147 -147
- package/src/pagination/css/pagination.css +7 -7
- package/src/pagination/css/pagination.css.map +1 -1
- package/src/pagination/paginationStrategy.js +53 -53
- package/src/pagination/providers/pages.js +161 -161
- package/src/pagination/providers/simple.js +74 -74
- package/src/pagination/providers/tpl/pages/page.tpl +1 -1
- package/src/pagination/providers/tpl/pages.tpl +8 -8
- package/src/pagination/providers/tpl/simple.tpl +7 -7
- package/src/pagination/scss/pagination.scss +111 -111
- package/src/pagination.js +237 -237
- package/src/previewer.js +300 -300
- package/src/progressbar.js +165 -165
- package/src/propertySelector/css/propertySelector.css +7 -7
- package/src/propertySelector/css/propertySelector.css.map +1 -1
- package/src/propertySelector/propertySelector.js +286 -286
- package/src/propertySelector/scss/propertySelector.scss +66 -66
- package/src/propertySelector/tpl/property-description.tpl +12 -12
- package/src/propertySelector/tpl/property-selector.tpl +6 -6
- package/src/report/feedback.tpl +11 -11
- package/src/report/layout.tpl +10 -10
- package/src/report.js +184 -184
- package/src/resource/css/selector.css +7 -7
- package/src/resource/css/selector.css.map +1 -1
- package/src/resource/filters.js +208 -208
- package/src/resource/list.js +200 -200
- package/src/resource/scss/_filters.scss +26 -26
- package/src/resource/scss/_resource-list.scss +107 -107
- package/src/resource/scss/_resource-tree.scss +205 -205
- package/src/resource/scss/selector.scss +187 -187
- package/src/resource/selectable.js +322 -322
- package/src/resource/selector.js +871 -871
- package/src/resource/tpl/filters.tpl +2 -2
- package/src/resource/tpl/list.tpl +7 -7
- package/src/resource/tpl/listNode.tpl +4 -4
- package/src/resource/tpl/selector.tpl +46 -46
- package/src/resource/tpl/tree.tpl +4 -4
- package/src/resource/tpl/treeNode.tpl +30 -30
- package/src/resource/tree.js +398 -398
- package/src/resourcemgr/css/resourcemgr.css +7 -7
- package/src/resourcemgr/css/resourcemgr.css.map +1 -1
- package/src/resourcemgr/fileBrowser.js +381 -381
- package/src/resourcemgr/filePreview.js +73 -73
- package/src/resourcemgr/fileSelector.js +322 -322
- package/src/resourcemgr/scss/resourcemgr.scss +254 -254
- package/src/resourcemgr/tpl/fileSelect.tpl +39 -39
- package/src/resourcemgr/tpl/folder.tpl +11 -11
- package/src/resourcemgr/tpl/layout.tpl +84 -84
- package/src/resourcemgr/tpl/rootFolder.tpl +13 -13
- package/src/resourcemgr/util/updatePermissions.js +53 -53
- package/src/resourcemgr.js +216 -216
- package/src/scroller.js +94 -94
- package/src/scss/basic.scss +16 -16
- package/src/searchModal/advancedSearch.js +638 -638
- package/src/searchModal/css/advancedSearch.css +7 -7
- package/src/searchModal/css/advancedSearch.css.map +1 -1
- package/src/searchModal/css/searchModal.css +7 -7
- package/src/searchModal/css/searchModal.css.map +1 -1
- package/src/searchModal/scss/advancedSearch.scss +171 -171
- package/src/searchModal/scss/searchModal.scss +393 -393
- package/src/searchModal/tpl/advanced-search.tpl +9 -9
- package/src/searchModal/tpl/info-message.tpl +3 -3
- package/src/searchModal/tpl/invalid-criteria-warning.tpl +10 -10
- package/src/searchModal/tpl/layout.tpl +27 -27
- package/src/searchModal/tpl/list-checkbox-criterion.tpl +17 -17
- package/src/searchModal/tpl/list-select-criterion.tpl +12 -12
- package/src/searchModal/tpl/text-criterion.tpl +11 -11
- package/src/searchModal.js +760 -760
- package/src/selecter.js +43 -43
- package/src/stacker.js +133 -133
- package/src/switch/css/switch.css +7 -7
- package/src/switch/css/switch.css.map +1 -1
- package/src/switch/scss/switch.scss +83 -83
- package/src/switch/switch.js +195 -195
- package/src/switch/tpl/switch.tpl +7 -7
- package/src/tableModel.js +112 -112
- package/src/tabs/css/tabs.css +12 -12
- package/src/tabs/css/tabs.css.map +1 -1
- package/src/tabs/scss/tabs.scss +50 -50
- package/src/tabs/tpl/panel.tpl +3 -3
- package/src/tabs/tpl/tabs.tpl +10 -10
- package/src/tabs.js +528 -528
- package/src/taskQueue/css/taskQueue.css +7 -7
- package/src/taskQueue/css/taskQueue.css.map +1 -1
- package/src/taskQueue/scss/taskQueue.scss +47 -47
- package/src/taskQueue/status.js +228 -228
- package/src/taskQueue/table.js +350 -350
- package/src/taskQueue/taskQueue.js +33 -33
- package/src/taskQueue/taskQueueModel.js +548 -548
- package/src/taskQueue/tpl/statusMessage.tpl +7 -7
- package/src/taskQueue.js +216 -216
- package/src/taskQueueButton/css/taskable.css +7 -7
- package/src/taskQueueButton/css/taskable.css.map +1 -1
- package/src/taskQueueButton/css/treeButton.css +7 -7
- package/src/taskQueueButton/css/treeButton.css.map +1 -1
- package/src/taskQueueButton/scss/taskable.scss +4 -4
- package/src/taskQueueButton/scss/treeButton.scss +34 -34
- package/src/taskQueueButton/standardButton.js +108 -108
- package/src/taskQueueButton/taskable.js +202 -202
- package/src/taskQueueButton/tpl/report.tpl +5 -5
- package/src/taskQueueButton/tpl/treeButton.tpl +6 -6
- package/src/taskQueueButton/treeButton.js +108 -108
- package/src/themeLoader.js +252 -252
- package/src/themes.js +162 -162
- package/src/toggler.js +200 -200
- package/src/tooltip/default.tpl +3 -3
- package/src/tooltip.js +160 -160
- package/src/tooltipster.js +25 -25
- package/src/transformer.js +327 -327
- package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css +7 -7
- package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +1 -1
- package/src/tristateCheckboxGroup/scss/tristateCheckboxGroup.scss +15 -15
- package/src/tristateCheckboxGroup/tpl/li.tpl +6 -6
- package/src/tristateCheckboxGroup.js +207 -207
- package/src/uploader/fileEntry.tpl +6 -6
- package/src/uploader/uploader.tpl +32 -32
- package/src/uploader.js +594 -594
- package/src/validator/Report.js +10 -10
- package/src/validator/Validator.js +108 -108
- package/src/validator/validators.js +217 -217
- package/src/validator.js +262 -262
- package/src/waitForMedia.js +82 -82
- package/src/waitingDialog/css/waitingDialog.css +7 -7
- package/src/waitingDialog/css/waitingDialog.css.map +1 -1
- package/src/waitingDialog/scss/waitingDialog.scss +34 -34
- package/src/waitingDialog/waitingDialog.js +240 -240
|
@@ -1,1030 +1,1030 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This program is free software; you can redistribute it and/or
|
|
3
|
-
* modify it under the terms of the GNU General Public License
|
|
4
|
-
* as published by the Free Software Foundation; under version 2
|
|
5
|
-
* of the License (non-upgradable).
|
|
6
|
-
*
|
|
7
|
-
* This program is distributed in the hope that it will be useful,
|
|
8
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
-
* GNU General Public License for more details.
|
|
11
|
-
*
|
|
12
|
-
* You should have received a copy of the GNU General Public License
|
|
13
|
-
* along with this program; if not, write to the Free Software
|
|
14
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
15
|
-
*
|
|
16
|
-
* Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
|
|
17
|
-
*/
|
|
18
|
-
import _ from 'lodash';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Singleton to edit the XHTML DTD and to retrieve element relationships.
|
|
22
|
-
* The DTD code itself is almost 1:1 copied from CKEDITOR
|
|
23
|
-
*/
|
|
24
|
-
var dtdHandler = (function () {
|
|
25
|
-
var dtdMode = 'html',
|
|
26
|
-
dtds = {};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Set DTD mode (qti|html)
|
|
30
|
-
*/
|
|
31
|
-
var setMode = function (mode) {
|
|
32
|
-
// for the oblivious ones such as myself:
|
|
33
|
-
if (mode.toLowerCase() === 'xhtml') {
|
|
34
|
-
mode = 'html';
|
|
35
|
-
}
|
|
36
|
-
if (!_.contains(['html', 'qti'], mode)) {
|
|
37
|
-
throw new Error('Unknown mode ' + mode);
|
|
38
|
-
}
|
|
39
|
-
dtdMode = mode;
|
|
40
|
-
return this;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Elements that are present in HTML 5 only
|
|
45
|
-
* @type {string[]}
|
|
46
|
-
*/
|
|
47
|
-
var html5Only = [
|
|
48
|
-
'article',
|
|
49
|
-
'aside',
|
|
50
|
-
'bdi',
|
|
51
|
-
'command',
|
|
52
|
-
'datalist',
|
|
53
|
-
'details',
|
|
54
|
-
'dialog',
|
|
55
|
-
'figcaption',
|
|
56
|
-
'figure',
|
|
57
|
-
'footer',
|
|
58
|
-
'header',
|
|
59
|
-
'keygen',
|
|
60
|
-
'main',
|
|
61
|
-
'mark',
|
|
62
|
-
'meter',
|
|
63
|
-
'nav',
|
|
64
|
-
'output',
|
|
65
|
-
'progress',
|
|
66
|
-
'rp',
|
|
67
|
-
'rt',
|
|
68
|
-
'ruby',
|
|
69
|
-
'section',
|
|
70
|
-
'summary',
|
|
71
|
-
'time',
|
|
72
|
-
'wbr',
|
|
73
|
-
'hgroup'
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Check in which element this element can be contained
|
|
78
|
-
*
|
|
79
|
-
* @param child (string|DOM element|jQuery element)
|
|
80
|
-
* @returns {Array}
|
|
81
|
-
*/
|
|
82
|
-
var getParentsOf = function (child) {
|
|
83
|
-
var parents = [],
|
|
84
|
-
element;
|
|
85
|
-
|
|
86
|
-
child = _normalizeElement(child);
|
|
87
|
-
|
|
88
|
-
for (element in dtds[dtdMode]) {
|
|
89
|
-
if (!Object.prototype.hasOwnProperty.call(dtds[dtdMode], element)) {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (element.indexOf('$') === 0) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (child in dtds[dtdMode][element]) {
|
|
96
|
-
parents.push(element);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return parents;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Get all elements parent can contain
|
|
104
|
-
*
|
|
105
|
-
* @param parent (string|DOM element|jQuery element)
|
|
106
|
-
* @returns {*}
|
|
107
|
-
*/
|
|
108
|
-
var getChildrenOf = function (parent) {
|
|
109
|
-
parent = _normalizeElement(parent);
|
|
110
|
-
|
|
111
|
-
if (parent in dtds[dtdMode]) {
|
|
112
|
-
return _.keys(dtds[dtdMode][parent]);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return [];
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Finds whether a child can have a certain parent
|
|
120
|
-
*
|
|
121
|
-
* @param child (string|DOM element|jQuery element)
|
|
122
|
-
* @param of (string|DOM element|jQuery element)
|
|
123
|
-
* @returns {*}
|
|
124
|
-
*/
|
|
125
|
-
var isChildOf = function (child, of) {
|
|
126
|
-
return _.contains(getChildrenOf(of), _normalizeElement(child));
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Finds whether a parent can have a certain child
|
|
131
|
-
*
|
|
132
|
-
* @param parent (string|DOM element|jQuery element)
|
|
133
|
-
* @param of (string|DOM element|jQuery element)
|
|
134
|
-
* @returns {*}
|
|
135
|
-
*/
|
|
136
|
-
var isParentOf = function (parent, of) {
|
|
137
|
-
return _.contains(getParentsOf(of), _normalizeElement(parent));
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Retrieve the current DTD
|
|
142
|
-
*
|
|
143
|
-
* @returns {*}
|
|
144
|
-
*/
|
|
145
|
-
var getDtd = function () {
|
|
146
|
-
return dtds[dtdMode];
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Retrieve the current dtdMode (qti|html)
|
|
151
|
-
*
|
|
152
|
-
* @returns {string}
|
|
153
|
-
*/
|
|
154
|
-
var getMode = function () {
|
|
155
|
-
return dtdMode;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Convert (node)element into string
|
|
160
|
-
*
|
|
161
|
-
* @param element (string|DOM element|jQuery element)
|
|
162
|
-
* @returns {*}
|
|
163
|
-
* @private
|
|
164
|
-
*/
|
|
165
|
-
function _normalizeElement(element) {
|
|
166
|
-
// jQuery or DOM element
|
|
167
|
-
if (_.isObject(element) && !_.isArray(element)) {
|
|
168
|
-
// DOM element
|
|
169
|
-
if ('nodeName' in element) {
|
|
170
|
-
return element.nodeName.toLowerCase();
|
|
171
|
-
}
|
|
172
|
-
// jQuery element
|
|
173
|
-
else if (0 in element && 'nodeName' in element[0]) {
|
|
174
|
-
return element[0].nodeName.toLowerCase();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
// node name
|
|
178
|
-
else if (_.isString(element)) {
|
|
179
|
-
return element.toLowerCase();
|
|
180
|
-
}
|
|
181
|
-
// invalid input
|
|
182
|
-
throw new Error('Unknown element ' + element);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* This part is almost literally copied from CKEDITOR (apart from using lodash instaed of CKEDITOR tools)
|
|
187
|
-
*
|
|
188
|
-
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
|
189
|
-
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
|
190
|
-
*/
|
|
191
|
-
dtds.html = (function () {
|
|
192
|
-
var X = _.extend,
|
|
193
|
-
Y = function (source, removed) {
|
|
194
|
-
var substracted = _.cloneDeep(source),
|
|
195
|
-
i,
|
|
196
|
-
name;
|
|
197
|
-
|
|
198
|
-
for (i = 1; i < arguments.length; i++) {
|
|
199
|
-
removed = arguments[i];
|
|
200
|
-
for (name in removed) delete substracted[name];
|
|
201
|
-
}
|
|
202
|
-
return substracted;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
// Phrasing elements.
|
|
206
|
-
// P = { a: 1, em: 1, strong: 1, small: 1, abbr: 1, dfn: 1, i: 1, b: 1, s: 1,
|
|
207
|
-
// u: 1, code: 1, 'var': 1, samp: 1, kbd: 1, sup: 1, sub: 1, q: 1, cite: 1,
|
|
208
|
-
// span: 1, bdo: 1, bdi: 1, br: 1, wbr: 1, ins: 1, del: 1, img: 1, embed: 1,
|
|
209
|
-
// object: 1, iframe: 1, map: 1, area: 1, script: 1, noscript: 1, ruby: 1,
|
|
210
|
-
// video: 1, audio: 1, input: 1, textarea: 1, select: 1, button: 1, label: 1,
|
|
211
|
-
// output: 1, keygen: 1, progress: 1, command: 1, canvas: 1, time: 1,
|
|
212
|
-
// meter: 1, detalist: 1 },
|
|
213
|
-
|
|
214
|
-
// Flow elements.
|
|
215
|
-
// F = { a: 1, p: 1, hr: 1, pre: 1, ul: 1, ol: 1, dl: 1, div: 1, h1: 1, h2: 1,
|
|
216
|
-
// h3: 1, h4: 1, h5: 1, h6: 1, hgroup: 1, address: 1, blockquote: 1, ins: 1,
|
|
217
|
-
// del: 1, object: 1, map: 1, noscript: 1, section: 1, nav: 1, article: 1,
|
|
218
|
-
// aside: 1, header: 1, footer: 1, video: 1, audio: 1, figure: 1, table: 1,
|
|
219
|
-
// form: 1, fieldset: 1, menu: 1, canvas: 1, details:1 },
|
|
220
|
-
|
|
221
|
-
// Text can be everywhere.
|
|
222
|
-
// X( P, T );
|
|
223
|
-
// Flow elements set consists of phrasing elements set.
|
|
224
|
-
// X( F, P );
|
|
225
|
-
|
|
226
|
-
var dtd,
|
|
227
|
-
P = {},
|
|
228
|
-
F = {},
|
|
229
|
-
// Intersection of flow elements set and phrasing elements set.
|
|
230
|
-
PF = {
|
|
231
|
-
a: 1,
|
|
232
|
-
abbr: 1,
|
|
233
|
-
area: 1,
|
|
234
|
-
audio: 1,
|
|
235
|
-
b: 1,
|
|
236
|
-
bdi: 1,
|
|
237
|
-
bdo: 1,
|
|
238
|
-
br: 1,
|
|
239
|
-
button: 1,
|
|
240
|
-
canvas: 1,
|
|
241
|
-
cite: 1,
|
|
242
|
-
code: 1,
|
|
243
|
-
command: 1,
|
|
244
|
-
datalist: 1,
|
|
245
|
-
del: 1,
|
|
246
|
-
dfn: 1,
|
|
247
|
-
em: 1,
|
|
248
|
-
embed: 1,
|
|
249
|
-
i: 1,
|
|
250
|
-
iframe: 1,
|
|
251
|
-
img: 1,
|
|
252
|
-
input: 1,
|
|
253
|
-
ins: 1,
|
|
254
|
-
kbd: 1,
|
|
255
|
-
keygen: 1,
|
|
256
|
-
label: 1,
|
|
257
|
-
map: 1,
|
|
258
|
-
mark: 1,
|
|
259
|
-
meter: 1,
|
|
260
|
-
noscript: 1,
|
|
261
|
-
object: 1,
|
|
262
|
-
output: 1,
|
|
263
|
-
progress: 1,
|
|
264
|
-
q: 1,
|
|
265
|
-
ruby: 1,
|
|
266
|
-
s: 1,
|
|
267
|
-
samp: 1,
|
|
268
|
-
script: 1,
|
|
269
|
-
select: 1,
|
|
270
|
-
small: 1,
|
|
271
|
-
span: 1,
|
|
272
|
-
strong: 1,
|
|
273
|
-
sub: 1,
|
|
274
|
-
sup: 1,
|
|
275
|
-
textarea: 1,
|
|
276
|
-
time: 1,
|
|
277
|
-
u: 1,
|
|
278
|
-
var: 1,
|
|
279
|
-
video: 1,
|
|
280
|
-
wbr: 1
|
|
281
|
-
},
|
|
282
|
-
// F - PF (Flow Only).
|
|
283
|
-
FO = {
|
|
284
|
-
address: 1,
|
|
285
|
-
article: 1,
|
|
286
|
-
aside: 1,
|
|
287
|
-
blockquote: 1,
|
|
288
|
-
details: 1,
|
|
289
|
-
div: 1,
|
|
290
|
-
dl: 1,
|
|
291
|
-
fieldset: 1,
|
|
292
|
-
figure: 1,
|
|
293
|
-
footer: 1,
|
|
294
|
-
form: 1,
|
|
295
|
-
h1: 1,
|
|
296
|
-
h2: 1,
|
|
297
|
-
h3: 1,
|
|
298
|
-
h4: 1,
|
|
299
|
-
h5: 1,
|
|
300
|
-
h6: 1,
|
|
301
|
-
header: 1,
|
|
302
|
-
hgroup: 1,
|
|
303
|
-
hr: 1,
|
|
304
|
-
menu: 1,
|
|
305
|
-
nav: 1,
|
|
306
|
-
ol: 1,
|
|
307
|
-
p: 1,
|
|
308
|
-
pre: 1,
|
|
309
|
-
section: 1,
|
|
310
|
-
table: 1,
|
|
311
|
-
ul: 1
|
|
312
|
-
},
|
|
313
|
-
// Metadata elements.
|
|
314
|
-
M = {
|
|
315
|
-
command: 1,
|
|
316
|
-
link: 1,
|
|
317
|
-
meta: 1,
|
|
318
|
-
noscript: 1,
|
|
319
|
-
script: 1,
|
|
320
|
-
style: 1
|
|
321
|
-
},
|
|
322
|
-
// Empty.
|
|
323
|
-
E = {},
|
|
324
|
-
// Text.
|
|
325
|
-
T = {
|
|
326
|
-
'#': 1
|
|
327
|
-
},
|
|
328
|
-
// Deprecated phrasing elements.
|
|
329
|
-
DP = {
|
|
330
|
-
acronym: 1,
|
|
331
|
-
applet: 1,
|
|
332
|
-
basefont: 1,
|
|
333
|
-
big: 1,
|
|
334
|
-
font: 1,
|
|
335
|
-
isindex: 1,
|
|
336
|
-
strike: 1,
|
|
337
|
-
style: 1,
|
|
338
|
-
tt: 1
|
|
339
|
-
}, // TODO remove "style".
|
|
340
|
-
// Deprecated flow only elements.
|
|
341
|
-
DFO = {
|
|
342
|
-
center: 1,
|
|
343
|
-
dir: 1,
|
|
344
|
-
noframes: 1
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// Phrasing elements := PF + T + DP
|
|
348
|
-
X(P, PF, T, DP);
|
|
349
|
-
// Flow elements := FO + P + DFO
|
|
350
|
-
X(F, FO, P, DFO);
|
|
351
|
-
|
|
352
|
-
dtd = {
|
|
353
|
-
a: Y(P, {
|
|
354
|
-
a: 1,
|
|
355
|
-
button: 1
|
|
356
|
-
}), // Treat as normal inline element (not a transparent one).
|
|
357
|
-
abbr: P,
|
|
358
|
-
address: F,
|
|
359
|
-
area: E,
|
|
360
|
-
article: X(
|
|
361
|
-
{
|
|
362
|
-
style: 1
|
|
363
|
-
},
|
|
364
|
-
F
|
|
365
|
-
),
|
|
366
|
-
aside: X(
|
|
367
|
-
{
|
|
368
|
-
style: 1
|
|
369
|
-
},
|
|
370
|
-
F
|
|
371
|
-
),
|
|
372
|
-
audio: X(
|
|
373
|
-
{
|
|
374
|
-
source: 1,
|
|
375
|
-
track: 1
|
|
376
|
-
},
|
|
377
|
-
F
|
|
378
|
-
),
|
|
379
|
-
b: P,
|
|
380
|
-
base: E,
|
|
381
|
-
bdi: P,
|
|
382
|
-
bdo: P,
|
|
383
|
-
blockquote: F,
|
|
384
|
-
body: F,
|
|
385
|
-
br: E,
|
|
386
|
-
button: Y(P, {
|
|
387
|
-
a: 1,
|
|
388
|
-
button: 1
|
|
389
|
-
}),
|
|
390
|
-
canvas: P, // Treat as normal inline element (not a transparent one).
|
|
391
|
-
caption: F,
|
|
392
|
-
cite: P,
|
|
393
|
-
code: P,
|
|
394
|
-
col: E,
|
|
395
|
-
colgroup: {
|
|
396
|
-
col: 1
|
|
397
|
-
},
|
|
398
|
-
command: E,
|
|
399
|
-
datalist: X(
|
|
400
|
-
{
|
|
401
|
-
option: 1
|
|
402
|
-
},
|
|
403
|
-
P
|
|
404
|
-
),
|
|
405
|
-
dd: F,
|
|
406
|
-
del: P, // Treat as normal inline element (not a transparent one).
|
|
407
|
-
details: X(
|
|
408
|
-
{
|
|
409
|
-
summary: 1
|
|
410
|
-
},
|
|
411
|
-
F
|
|
412
|
-
),
|
|
413
|
-
dfn: P,
|
|
414
|
-
div: X(
|
|
415
|
-
{
|
|
416
|
-
style: 1
|
|
417
|
-
},
|
|
418
|
-
F
|
|
419
|
-
),
|
|
420
|
-
dl: {
|
|
421
|
-
dt: 1,
|
|
422
|
-
dd: 1
|
|
423
|
-
},
|
|
424
|
-
dt: F,
|
|
425
|
-
em: P,
|
|
426
|
-
embed: E,
|
|
427
|
-
fieldset: X(
|
|
428
|
-
{
|
|
429
|
-
legend: 1
|
|
430
|
-
},
|
|
431
|
-
F
|
|
432
|
-
),
|
|
433
|
-
figcaption: F,
|
|
434
|
-
figure: X(
|
|
435
|
-
{
|
|
436
|
-
figcaption: 1
|
|
437
|
-
},
|
|
438
|
-
F
|
|
439
|
-
),
|
|
440
|
-
footer: F,
|
|
441
|
-
form: F,
|
|
442
|
-
h1: P,
|
|
443
|
-
h2: P,
|
|
444
|
-
h3: P,
|
|
445
|
-
h4: P,
|
|
446
|
-
h5: P,
|
|
447
|
-
h6: P,
|
|
448
|
-
head: X(
|
|
449
|
-
{
|
|
450
|
-
title: 1,
|
|
451
|
-
base: 1
|
|
452
|
-
},
|
|
453
|
-
M
|
|
454
|
-
),
|
|
455
|
-
header: F,
|
|
456
|
-
hgroup: {
|
|
457
|
-
h1: 1,
|
|
458
|
-
h2: 1,
|
|
459
|
-
h3: 1,
|
|
460
|
-
h4: 1,
|
|
461
|
-
h5: 1,
|
|
462
|
-
h6: 1
|
|
463
|
-
},
|
|
464
|
-
hr: E,
|
|
465
|
-
html: X(
|
|
466
|
-
{
|
|
467
|
-
head: 1,
|
|
468
|
-
body: 1
|
|
469
|
-
},
|
|
470
|
-
F,
|
|
471
|
-
M
|
|
472
|
-
), // Head and body are optional...
|
|
473
|
-
i: P,
|
|
474
|
-
iframe: T,
|
|
475
|
-
img: E,
|
|
476
|
-
input: E,
|
|
477
|
-
ins: P, // Treat as normal inline element (not a transparent one).
|
|
478
|
-
kbd: P,
|
|
479
|
-
keygen: E,
|
|
480
|
-
label: P,
|
|
481
|
-
legend: P,
|
|
482
|
-
li: F,
|
|
483
|
-
link: E,
|
|
484
|
-
map: F,
|
|
485
|
-
mark: P, // Treat as normal inline element (not a transparent one).
|
|
486
|
-
menu: X(
|
|
487
|
-
{
|
|
488
|
-
li: 1
|
|
489
|
-
},
|
|
490
|
-
F
|
|
491
|
-
),
|
|
492
|
-
meta: E,
|
|
493
|
-
meter: Y(P, {
|
|
494
|
-
meter: 1
|
|
495
|
-
}),
|
|
496
|
-
nav: F,
|
|
497
|
-
noscript: X(
|
|
498
|
-
{
|
|
499
|
-
link: 1,
|
|
500
|
-
meta: 1,
|
|
501
|
-
style: 1
|
|
502
|
-
},
|
|
503
|
-
P
|
|
504
|
-
), // Treat as normal inline element (not a transparent one).
|
|
505
|
-
object: X(
|
|
506
|
-
{
|
|
507
|
-
param: 1
|
|
508
|
-
},
|
|
509
|
-
P
|
|
510
|
-
), // Treat as normal inline element (not a transparent one).
|
|
511
|
-
ol: {
|
|
512
|
-
li: 1
|
|
513
|
-
},
|
|
514
|
-
optgroup: {
|
|
515
|
-
option: 1
|
|
516
|
-
},
|
|
517
|
-
option: T,
|
|
518
|
-
output: P,
|
|
519
|
-
p: P,
|
|
520
|
-
param: E,
|
|
521
|
-
pre: P,
|
|
522
|
-
progress: Y(P, {
|
|
523
|
-
progress: 1
|
|
524
|
-
}),
|
|
525
|
-
q: P,
|
|
526
|
-
rp: P,
|
|
527
|
-
rt: P,
|
|
528
|
-
ruby: X(
|
|
529
|
-
{
|
|
530
|
-
rp: 1,
|
|
531
|
-
rt: 1
|
|
532
|
-
},
|
|
533
|
-
P
|
|
534
|
-
),
|
|
535
|
-
s: P,
|
|
536
|
-
samp: P,
|
|
537
|
-
script: T,
|
|
538
|
-
section: X(
|
|
539
|
-
{
|
|
540
|
-
style: 1
|
|
541
|
-
},
|
|
542
|
-
F
|
|
543
|
-
),
|
|
544
|
-
select: {
|
|
545
|
-
optgroup: 1,
|
|
546
|
-
option: 1
|
|
547
|
-
},
|
|
548
|
-
small: P,
|
|
549
|
-
source: E,
|
|
550
|
-
span: P,
|
|
551
|
-
strong: P,
|
|
552
|
-
style: T,
|
|
553
|
-
sub: P,
|
|
554
|
-
summary: P,
|
|
555
|
-
sup: P,
|
|
556
|
-
table: {
|
|
557
|
-
caption: 1,
|
|
558
|
-
colgroup: 1,
|
|
559
|
-
thead: 1,
|
|
560
|
-
tfoot: 1,
|
|
561
|
-
tbody: 1,
|
|
562
|
-
tr: 1
|
|
563
|
-
},
|
|
564
|
-
tbody: {
|
|
565
|
-
tr: 1
|
|
566
|
-
},
|
|
567
|
-
td: F,
|
|
568
|
-
textarea: T,
|
|
569
|
-
tfoot: {
|
|
570
|
-
tr: 1
|
|
571
|
-
},
|
|
572
|
-
th: F,
|
|
573
|
-
thead: {
|
|
574
|
-
tr: 1
|
|
575
|
-
},
|
|
576
|
-
time: Y(P, {
|
|
577
|
-
time: 1
|
|
578
|
-
}),
|
|
579
|
-
title: T,
|
|
580
|
-
tr: {
|
|
581
|
-
th: 1,
|
|
582
|
-
td: 1
|
|
583
|
-
},
|
|
584
|
-
track: E,
|
|
585
|
-
u: P,
|
|
586
|
-
ul: {
|
|
587
|
-
li: 1
|
|
588
|
-
},
|
|
589
|
-
var: P,
|
|
590
|
-
video: X(
|
|
591
|
-
{
|
|
592
|
-
source: 1,
|
|
593
|
-
track: 1
|
|
594
|
-
},
|
|
595
|
-
F
|
|
596
|
-
),
|
|
597
|
-
wbr: E,
|
|
598
|
-
|
|
599
|
-
// Deprecated tags.
|
|
600
|
-
acronym: P,
|
|
601
|
-
applet: X(
|
|
602
|
-
{
|
|
603
|
-
param: 1
|
|
604
|
-
},
|
|
605
|
-
F
|
|
606
|
-
),
|
|
607
|
-
basefont: E,
|
|
608
|
-
big: P,
|
|
609
|
-
center: F,
|
|
610
|
-
dialog: E,
|
|
611
|
-
dir: {
|
|
612
|
-
li: 1
|
|
613
|
-
},
|
|
614
|
-
font: P,
|
|
615
|
-
isindex: E,
|
|
616
|
-
noframes: F,
|
|
617
|
-
strike: P,
|
|
618
|
-
tt: P
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
X(dtd, {
|
|
622
|
-
/**
|
|
623
|
-
* List of block elements, like `<p>` or `<div>`.
|
|
624
|
-
*/
|
|
625
|
-
$block: X(
|
|
626
|
-
{
|
|
627
|
-
audio: 1,
|
|
628
|
-
dd: 1,
|
|
629
|
-
dt: 1,
|
|
630
|
-
figcaption: 1,
|
|
631
|
-
li: 1,
|
|
632
|
-
video: 1
|
|
633
|
-
},
|
|
634
|
-
FO,
|
|
635
|
-
DFO
|
|
636
|
-
),
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* List of elements that contain other blocks, in which block-level operations should be limited,
|
|
640
|
-
* this property is not intended to be checked directly, use {@link CKEDITOR.dom.elementPath#blockLimit} instead.
|
|
641
|
-
*
|
|
642
|
-
* Some examples of editor behaviors that are impacted by block limits:
|
|
643
|
-
*
|
|
644
|
-
* * Enter key never split a block-limit element;
|
|
645
|
-
* * Style application is constraint by the block limit of the current selection.
|
|
646
|
-
* * Pasted html will be inserted into the block limit of the current selection.
|
|
647
|
-
*
|
|
648
|
-
* **Note:** As an exception `<li>` is not considered as a block limit, as it's generally used as a text block.
|
|
649
|
-
*/
|
|
650
|
-
$blockLimit: {
|
|
651
|
-
article: 1,
|
|
652
|
-
aside: 1,
|
|
653
|
-
audio: 1,
|
|
654
|
-
body: 1,
|
|
655
|
-
caption: 1,
|
|
656
|
-
details: 1,
|
|
657
|
-
dir: 1,
|
|
658
|
-
div: 1,
|
|
659
|
-
dl: 1,
|
|
660
|
-
fieldset: 1,
|
|
661
|
-
figcaption: 1,
|
|
662
|
-
figure: 1,
|
|
663
|
-
footer: 1,
|
|
664
|
-
form: 1,
|
|
665
|
-
header: 1,
|
|
666
|
-
hgroup: 1,
|
|
667
|
-
menu: 1,
|
|
668
|
-
nav: 1,
|
|
669
|
-
ol: 1,
|
|
670
|
-
section: 1,
|
|
671
|
-
table: 1,
|
|
672
|
-
td: 1,
|
|
673
|
-
th: 1,
|
|
674
|
-
tr: 1,
|
|
675
|
-
ul: 1,
|
|
676
|
-
video: 1
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* List of elements that contain character data.
|
|
681
|
-
*/
|
|
682
|
-
$cdata: {
|
|
683
|
-
script: 1,
|
|
684
|
-
style: 1
|
|
685
|
-
},
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* List of elements that are accepted as inline editing hosts.
|
|
689
|
-
*/
|
|
690
|
-
$editable: {
|
|
691
|
-
address: 1,
|
|
692
|
-
article: 1,
|
|
693
|
-
aside: 1,
|
|
694
|
-
blockquote: 1,
|
|
695
|
-
body: 1,
|
|
696
|
-
details: 1,
|
|
697
|
-
div: 1,
|
|
698
|
-
fieldset: 1,
|
|
699
|
-
figcaption: 1,
|
|
700
|
-
footer: 1,
|
|
701
|
-
form: 1,
|
|
702
|
-
h1: 1,
|
|
703
|
-
h2: 1,
|
|
704
|
-
h3: 1,
|
|
705
|
-
h4: 1,
|
|
706
|
-
h5: 1,
|
|
707
|
-
h6: 1,
|
|
708
|
-
header: 1,
|
|
709
|
-
hgroup: 1,
|
|
710
|
-
nav: 1,
|
|
711
|
-
p: 1,
|
|
712
|
-
pre: 1,
|
|
713
|
-
section: 1,
|
|
714
|
-
table: 1
|
|
715
|
-
},
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* List of empty (self-closing) elements, like `<br>` or `<img>`.
|
|
719
|
-
*/
|
|
720
|
-
$empty: {
|
|
721
|
-
area: 1,
|
|
722
|
-
base: 1,
|
|
723
|
-
basefont: 1,
|
|
724
|
-
br: 1,
|
|
725
|
-
col: 1,
|
|
726
|
-
command: 1,
|
|
727
|
-
dialog: 1,
|
|
728
|
-
embed: 1,
|
|
729
|
-
hr: 1,
|
|
730
|
-
img: 1,
|
|
731
|
-
input: 1,
|
|
732
|
-
isindex: 1,
|
|
733
|
-
keygen: 1,
|
|
734
|
-
link: 1,
|
|
735
|
-
meta: 1,
|
|
736
|
-
param: 1,
|
|
737
|
-
source: 1,
|
|
738
|
-
track: 1,
|
|
739
|
-
wbr: 1
|
|
740
|
-
},
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* List of inline (`<span>` like) elements.
|
|
744
|
-
*/
|
|
745
|
-
$inline: P,
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* List of list root elements.
|
|
749
|
-
*/
|
|
750
|
-
$list: {
|
|
751
|
-
dl: 1,
|
|
752
|
-
ol: 1,
|
|
753
|
-
ul: 1
|
|
754
|
-
},
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* List of list item elements, like `<li>` or `<dd>`.
|
|
758
|
-
*/
|
|
759
|
-
$listItem: {
|
|
760
|
-
dd: 1,
|
|
761
|
-
dt: 1,
|
|
762
|
-
li: 1
|
|
763
|
-
},
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* List of elements which may live outside body.
|
|
767
|
-
*/
|
|
768
|
-
$nonBodyContent: X(
|
|
769
|
-
{
|
|
770
|
-
body: 1,
|
|
771
|
-
head: 1,
|
|
772
|
-
html: 1
|
|
773
|
-
},
|
|
774
|
-
dtd.head
|
|
775
|
-
),
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* Elements that accept text nodes, but are not possible to edit into the browser.
|
|
779
|
-
*/
|
|
780
|
-
$nonEditable: {
|
|
781
|
-
applet: 1,
|
|
782
|
-
audio: 1,
|
|
783
|
-
button: 1,
|
|
784
|
-
embed: 1,
|
|
785
|
-
iframe: 1,
|
|
786
|
-
map: 1,
|
|
787
|
-
object: 1,
|
|
788
|
-
option: 1,
|
|
789
|
-
param: 1,
|
|
790
|
-
script: 1,
|
|
791
|
-
textarea: 1,
|
|
792
|
-
video: 1
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
/**
|
|
796
|
-
* Elements that are considered objects, therefore selected as a whole in the editor.
|
|
797
|
-
*/
|
|
798
|
-
$object: {
|
|
799
|
-
applet: 1,
|
|
800
|
-
audio: 1,
|
|
801
|
-
button: 1,
|
|
802
|
-
hr: 1,
|
|
803
|
-
iframe: 1,
|
|
804
|
-
img: 1,
|
|
805
|
-
input: 1,
|
|
806
|
-
object: 1,
|
|
807
|
-
select: 1,
|
|
808
|
-
table: 1,
|
|
809
|
-
textarea: 1,
|
|
810
|
-
video: 1
|
|
811
|
-
},
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* List of elements that can be ignored if empty, like `<b>` or `<span>`.
|
|
815
|
-
*/
|
|
816
|
-
$removeEmpty: {
|
|
817
|
-
abbr: 1,
|
|
818
|
-
acronym: 1,
|
|
819
|
-
b: 1,
|
|
820
|
-
bdi: 1,
|
|
821
|
-
bdo: 1,
|
|
822
|
-
big: 1,
|
|
823
|
-
cite: 1,
|
|
824
|
-
code: 1,
|
|
825
|
-
del: 1,
|
|
826
|
-
dfn: 1,
|
|
827
|
-
em: 1,
|
|
828
|
-
font: 1,
|
|
829
|
-
i: 1,
|
|
830
|
-
ins: 1,
|
|
831
|
-
label: 1,
|
|
832
|
-
kbd: 1,
|
|
833
|
-
mark: 1,
|
|
834
|
-
meter: 1,
|
|
835
|
-
output: 1,
|
|
836
|
-
q: 1,
|
|
837
|
-
ruby: 1,
|
|
838
|
-
s: 1,
|
|
839
|
-
samp: 1,
|
|
840
|
-
small: 1,
|
|
841
|
-
span: 1,
|
|
842
|
-
strike: 1,
|
|
843
|
-
strong: 1,
|
|
844
|
-
sub: 1,
|
|
845
|
-
sup: 1,
|
|
846
|
-
time: 1,
|
|
847
|
-
tt: 1,
|
|
848
|
-
u: 1,
|
|
849
|
-
var: 1
|
|
850
|
-
},
|
|
851
|
-
|
|
852
|
-
/**
|
|
853
|
-
* List of elements that have tabindex set to zero by default.
|
|
854
|
-
*/
|
|
855
|
-
$tabIndex: {
|
|
856
|
-
a: 1,
|
|
857
|
-
area: 1,
|
|
858
|
-
button: 1,
|
|
859
|
-
input: 1,
|
|
860
|
-
object: 1,
|
|
861
|
-
select: 1,
|
|
862
|
-
textarea: 1
|
|
863
|
-
},
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* List of elements used inside the `<table>` element, like `<tbody>` or `<td>`.
|
|
867
|
-
*/
|
|
868
|
-
$tableContent: {
|
|
869
|
-
caption: 1,
|
|
870
|
-
col: 1,
|
|
871
|
-
colgroup: 1,
|
|
872
|
-
tbody: 1,
|
|
873
|
-
td: 1,
|
|
874
|
-
tfoot: 1,
|
|
875
|
-
th: 1,
|
|
876
|
-
thead: 1,
|
|
877
|
-
tr: 1
|
|
878
|
-
},
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* List of "transparent" elements. See [W3C's definition of "transparent" element](http://dev.w3.org/html5/markup/terminology.html#transparent).
|
|
882
|
-
*/
|
|
883
|
-
$transparent: {
|
|
884
|
-
a: 1,
|
|
885
|
-
audio: 1,
|
|
886
|
-
canvas: 1,
|
|
887
|
-
del: 1,
|
|
888
|
-
ins: 1,
|
|
889
|
-
map: 1,
|
|
890
|
-
noscript: 1,
|
|
891
|
-
object: 1,
|
|
892
|
-
video: 1
|
|
893
|
-
},
|
|
894
|
-
|
|
895
|
-
/**
|
|
896
|
-
* List of elements that are not to exist standalone that must live under its parent element.
|
|
897
|
-
*/
|
|
898
|
-
$intermediate: {
|
|
899
|
-
caption: 1,
|
|
900
|
-
colgroup: 1,
|
|
901
|
-
dd: 1,
|
|
902
|
-
dt: 1,
|
|
903
|
-
figcaption: 1,
|
|
904
|
-
legend: 1,
|
|
905
|
-
li: 1,
|
|
906
|
-
optgroup: 1,
|
|
907
|
-
option: 1,
|
|
908
|
-
rp: 1,
|
|
909
|
-
rt: 1,
|
|
910
|
-
summary: 1,
|
|
911
|
-
tbody: 1,
|
|
912
|
-
td: 1,
|
|
913
|
-
tfoot: 1,
|
|
914
|
-
th: 1,
|
|
915
|
-
thead: 1,
|
|
916
|
-
tr: 1
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
return dtd;
|
|
921
|
-
})();
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Applies QTI rules to a copy of the xhtmlDtd
|
|
925
|
-
*
|
|
926
|
-
* @return dtd {object} the modified dtd
|
|
927
|
-
*/
|
|
928
|
-
dtds.qti = (function () {
|
|
929
|
-
var element,
|
|
930
|
-
listCnt,
|
|
931
|
-
child,
|
|
932
|
-
actions = ['remove', 'add'],
|
|
933
|
-
actCnt,
|
|
934
|
-
actLnt = actions.length,
|
|
935
|
-
action,
|
|
936
|
-
overrides = {
|
|
937
|
-
pre: {
|
|
938
|
-
add: [],
|
|
939
|
-
remove: ['img', 'object', 'big', 'small', 'sub', 'sup']
|
|
940
|
-
},
|
|
941
|
-
table: {
|
|
942
|
-
remove: ['col']
|
|
943
|
-
}
|
|
944
|
-
},
|
|
945
|
-
qtiDtd = _.cloneDeep(dtds.html),
|
|
946
|
-
tmp,
|
|
947
|
-
h5Len = html5Only.length,
|
|
948
|
-
intersection;
|
|
949
|
-
|
|
950
|
-
// remove html5-only keys
|
|
951
|
-
while (h5Len--) {
|
|
952
|
-
delete qtiDtd[html5Only[h5Len]];
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
// find html5-only elements in children and add them to overrides
|
|
956
|
-
for (element in qtiDtd) {
|
|
957
|
-
if (!Object.prototype.hasOwnProperty.call(qtiDtd, element)) {
|
|
958
|
-
continue;
|
|
959
|
-
}
|
|
960
|
-
intersection = _.intersection(_.keys(qtiDtd[element]), html5Only);
|
|
961
|
-
if (!intersection.length) {
|
|
962
|
-
continue;
|
|
963
|
-
}
|
|
964
|
-
if (!overrides[element]) {
|
|
965
|
-
overrides[element] = {
|
|
966
|
-
remove: []
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
overrides[element].remove = overrides[element].remove.concat(intersection);
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
// execute overrides
|
|
973
|
-
for (element in overrides) {
|
|
974
|
-
if (!Object.prototype.hasOwnProperty.call(overrides, element)) {
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
// disallow adding keys to the dtd ckeditor cannot handle
|
|
978
|
-
if (!Object.prototype.hasOwnProperty.call(qtiDtd, element)) {
|
|
979
|
-
continue;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
// note: removing and adding is on purpose done in two steps
|
|
983
|
-
for (actCnt = 0; actCnt < actLnt; actCnt++) {
|
|
984
|
-
action = actions[actCnt];
|
|
985
|
-
if (!(action in overrides[element])) {
|
|
986
|
-
continue;
|
|
987
|
-
}
|
|
988
|
-
listCnt = overrides[element][action].length;
|
|
989
|
-
|
|
990
|
-
// allow 'all' as a shortcut for 'remove all children'
|
|
991
|
-
if (action === 'remove' && overrides[element][action] === 'all') {
|
|
992
|
-
qtiDtd[element] = {};
|
|
993
|
-
continue;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
// doggy style loop over children to add
|
|
997
|
-
while (listCnt--) {
|
|
998
|
-
child = overrides[element][action][listCnt];
|
|
999
|
-
// there was some weird behaviour with references
|
|
1000
|
-
// deleting from pre would also delete from p
|
|
1001
|
-
// going over a tmp var solves this, though I have no idea why
|
|
1002
|
-
tmp = _.cloneDeep(qtiDtd[element]);
|
|
1003
|
-
if (action === 'remove') {
|
|
1004
|
-
delete tmp[child];
|
|
1005
|
-
qtiDtd[element] = tmp;
|
|
1006
|
-
}
|
|
1007
|
-
// add child element to element as long as it's not entirely unknown to ckeditor
|
|
1008
|
-
else if (action === 'add' && typeof qtiDtd[child] !== 'undefined') {
|
|
1009
|
-
tmp[child] = 1;
|
|
1010
|
-
qtiDtd[element] = tmp[child];
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
return qtiDtd;
|
|
1017
|
-
})();
|
|
1018
|
-
|
|
1019
|
-
return {
|
|
1020
|
-
getDtd: getDtd,
|
|
1021
|
-
getChildrenOf: getChildrenOf,
|
|
1022
|
-
getParentsOf: getParentsOf,
|
|
1023
|
-
isChildOf: isChildOf,
|
|
1024
|
-
isParentOf: isParentOf,
|
|
1025
|
-
getMode: getMode,
|
|
1026
|
-
setMode: setMode
|
|
1027
|
-
};
|
|
1028
|
-
})();
|
|
1029
|
-
|
|
1030
|
-
export default dtdHandler;
|
|
1
|
+
/**
|
|
2
|
+
* This program is free software; you can redistribute it and/or
|
|
3
|
+
* modify it under the terms of the GNU General Public License
|
|
4
|
+
* as published by the Free Software Foundation; under version 2
|
|
5
|
+
* of the License (non-upgradable).
|
|
6
|
+
*
|
|
7
|
+
* This program is distributed in the hope that it will be useful,
|
|
8
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
+
* GNU General Public License for more details.
|
|
11
|
+
*
|
|
12
|
+
* You should have received a copy of the GNU General Public License
|
|
13
|
+
* along with this program; if not, write to the Free Software
|
|
14
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
|
|
17
|
+
*/
|
|
18
|
+
import _ from 'lodash';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Singleton to edit the XHTML DTD and to retrieve element relationships.
|
|
22
|
+
* The DTD code itself is almost 1:1 copied from CKEDITOR
|
|
23
|
+
*/
|
|
24
|
+
var dtdHandler = (function () {
|
|
25
|
+
var dtdMode = 'html',
|
|
26
|
+
dtds = {};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Set DTD mode (qti|html)
|
|
30
|
+
*/
|
|
31
|
+
var setMode = function (mode) {
|
|
32
|
+
// for the oblivious ones such as myself:
|
|
33
|
+
if (mode.toLowerCase() === 'xhtml') {
|
|
34
|
+
mode = 'html';
|
|
35
|
+
}
|
|
36
|
+
if (!_.contains(['html', 'qti'], mode)) {
|
|
37
|
+
throw new Error('Unknown mode ' + mode);
|
|
38
|
+
}
|
|
39
|
+
dtdMode = mode;
|
|
40
|
+
return this;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Elements that are present in HTML 5 only
|
|
45
|
+
* @type {string[]}
|
|
46
|
+
*/
|
|
47
|
+
var html5Only = [
|
|
48
|
+
'article',
|
|
49
|
+
'aside',
|
|
50
|
+
'bdi',
|
|
51
|
+
'command',
|
|
52
|
+
'datalist',
|
|
53
|
+
'details',
|
|
54
|
+
'dialog',
|
|
55
|
+
'figcaption',
|
|
56
|
+
'figure',
|
|
57
|
+
'footer',
|
|
58
|
+
'header',
|
|
59
|
+
'keygen',
|
|
60
|
+
'main',
|
|
61
|
+
'mark',
|
|
62
|
+
'meter',
|
|
63
|
+
'nav',
|
|
64
|
+
'output',
|
|
65
|
+
'progress',
|
|
66
|
+
'rp',
|
|
67
|
+
'rt',
|
|
68
|
+
'ruby',
|
|
69
|
+
'section',
|
|
70
|
+
'summary',
|
|
71
|
+
'time',
|
|
72
|
+
'wbr',
|
|
73
|
+
'hgroup'
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Check in which element this element can be contained
|
|
78
|
+
*
|
|
79
|
+
* @param child (string|DOM element|jQuery element)
|
|
80
|
+
* @returns {Array}
|
|
81
|
+
*/
|
|
82
|
+
var getParentsOf = function (child) {
|
|
83
|
+
var parents = [],
|
|
84
|
+
element;
|
|
85
|
+
|
|
86
|
+
child = _normalizeElement(child);
|
|
87
|
+
|
|
88
|
+
for (element in dtds[dtdMode]) {
|
|
89
|
+
if (!Object.prototype.hasOwnProperty.call(dtds[dtdMode], element)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (element.indexOf('$') === 0) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (child in dtds[dtdMode][element]) {
|
|
96
|
+
parents.push(element);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return parents;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get all elements parent can contain
|
|
104
|
+
*
|
|
105
|
+
* @param parent (string|DOM element|jQuery element)
|
|
106
|
+
* @returns {*}
|
|
107
|
+
*/
|
|
108
|
+
var getChildrenOf = function (parent) {
|
|
109
|
+
parent = _normalizeElement(parent);
|
|
110
|
+
|
|
111
|
+
if (parent in dtds[dtdMode]) {
|
|
112
|
+
return _.keys(dtds[dtdMode][parent]);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return [];
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Finds whether a child can have a certain parent
|
|
120
|
+
*
|
|
121
|
+
* @param child (string|DOM element|jQuery element)
|
|
122
|
+
* @param of (string|DOM element|jQuery element)
|
|
123
|
+
* @returns {*}
|
|
124
|
+
*/
|
|
125
|
+
var isChildOf = function (child, of) {
|
|
126
|
+
return _.contains(getChildrenOf(of), _normalizeElement(child));
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Finds whether a parent can have a certain child
|
|
131
|
+
*
|
|
132
|
+
* @param parent (string|DOM element|jQuery element)
|
|
133
|
+
* @param of (string|DOM element|jQuery element)
|
|
134
|
+
* @returns {*}
|
|
135
|
+
*/
|
|
136
|
+
var isParentOf = function (parent, of) {
|
|
137
|
+
return _.contains(getParentsOf(of), _normalizeElement(parent));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Retrieve the current DTD
|
|
142
|
+
*
|
|
143
|
+
* @returns {*}
|
|
144
|
+
*/
|
|
145
|
+
var getDtd = function () {
|
|
146
|
+
return dtds[dtdMode];
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Retrieve the current dtdMode (qti|html)
|
|
151
|
+
*
|
|
152
|
+
* @returns {string}
|
|
153
|
+
*/
|
|
154
|
+
var getMode = function () {
|
|
155
|
+
return dtdMode;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Convert (node)element into string
|
|
160
|
+
*
|
|
161
|
+
* @param element (string|DOM element|jQuery element)
|
|
162
|
+
* @returns {*}
|
|
163
|
+
* @private
|
|
164
|
+
*/
|
|
165
|
+
function _normalizeElement(element) {
|
|
166
|
+
// jQuery or DOM element
|
|
167
|
+
if (_.isObject(element) && !_.isArray(element)) {
|
|
168
|
+
// DOM element
|
|
169
|
+
if ('nodeName' in element) {
|
|
170
|
+
return element.nodeName.toLowerCase();
|
|
171
|
+
}
|
|
172
|
+
// jQuery element
|
|
173
|
+
else if (0 in element && 'nodeName' in element[0]) {
|
|
174
|
+
return element[0].nodeName.toLowerCase();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// node name
|
|
178
|
+
else if (_.isString(element)) {
|
|
179
|
+
return element.toLowerCase();
|
|
180
|
+
}
|
|
181
|
+
// invalid input
|
|
182
|
+
throw new Error('Unknown element ' + element);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* This part is almost literally copied from CKEDITOR (apart from using lodash instaed of CKEDITOR tools)
|
|
187
|
+
*
|
|
188
|
+
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
|
189
|
+
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
|
190
|
+
*/
|
|
191
|
+
dtds.html = (function () {
|
|
192
|
+
var X = _.extend,
|
|
193
|
+
Y = function (source, removed) {
|
|
194
|
+
var substracted = _.cloneDeep(source),
|
|
195
|
+
i,
|
|
196
|
+
name;
|
|
197
|
+
|
|
198
|
+
for (i = 1; i < arguments.length; i++) {
|
|
199
|
+
removed = arguments[i];
|
|
200
|
+
for (name in removed) delete substracted[name];
|
|
201
|
+
}
|
|
202
|
+
return substracted;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// Phrasing elements.
|
|
206
|
+
// P = { a: 1, em: 1, strong: 1, small: 1, abbr: 1, dfn: 1, i: 1, b: 1, s: 1,
|
|
207
|
+
// u: 1, code: 1, 'var': 1, samp: 1, kbd: 1, sup: 1, sub: 1, q: 1, cite: 1,
|
|
208
|
+
// span: 1, bdo: 1, bdi: 1, br: 1, wbr: 1, ins: 1, del: 1, img: 1, embed: 1,
|
|
209
|
+
// object: 1, iframe: 1, map: 1, area: 1, script: 1, noscript: 1, ruby: 1,
|
|
210
|
+
// video: 1, audio: 1, input: 1, textarea: 1, select: 1, button: 1, label: 1,
|
|
211
|
+
// output: 1, keygen: 1, progress: 1, command: 1, canvas: 1, time: 1,
|
|
212
|
+
// meter: 1, detalist: 1 },
|
|
213
|
+
|
|
214
|
+
// Flow elements.
|
|
215
|
+
// F = { a: 1, p: 1, hr: 1, pre: 1, ul: 1, ol: 1, dl: 1, div: 1, h1: 1, h2: 1,
|
|
216
|
+
// h3: 1, h4: 1, h5: 1, h6: 1, hgroup: 1, address: 1, blockquote: 1, ins: 1,
|
|
217
|
+
// del: 1, object: 1, map: 1, noscript: 1, section: 1, nav: 1, article: 1,
|
|
218
|
+
// aside: 1, header: 1, footer: 1, video: 1, audio: 1, figure: 1, table: 1,
|
|
219
|
+
// form: 1, fieldset: 1, menu: 1, canvas: 1, details:1 },
|
|
220
|
+
|
|
221
|
+
// Text can be everywhere.
|
|
222
|
+
// X( P, T );
|
|
223
|
+
// Flow elements set consists of phrasing elements set.
|
|
224
|
+
// X( F, P );
|
|
225
|
+
|
|
226
|
+
var dtd,
|
|
227
|
+
P = {},
|
|
228
|
+
F = {},
|
|
229
|
+
// Intersection of flow elements set and phrasing elements set.
|
|
230
|
+
PF = {
|
|
231
|
+
a: 1,
|
|
232
|
+
abbr: 1,
|
|
233
|
+
area: 1,
|
|
234
|
+
audio: 1,
|
|
235
|
+
b: 1,
|
|
236
|
+
bdi: 1,
|
|
237
|
+
bdo: 1,
|
|
238
|
+
br: 1,
|
|
239
|
+
button: 1,
|
|
240
|
+
canvas: 1,
|
|
241
|
+
cite: 1,
|
|
242
|
+
code: 1,
|
|
243
|
+
command: 1,
|
|
244
|
+
datalist: 1,
|
|
245
|
+
del: 1,
|
|
246
|
+
dfn: 1,
|
|
247
|
+
em: 1,
|
|
248
|
+
embed: 1,
|
|
249
|
+
i: 1,
|
|
250
|
+
iframe: 1,
|
|
251
|
+
img: 1,
|
|
252
|
+
input: 1,
|
|
253
|
+
ins: 1,
|
|
254
|
+
kbd: 1,
|
|
255
|
+
keygen: 1,
|
|
256
|
+
label: 1,
|
|
257
|
+
map: 1,
|
|
258
|
+
mark: 1,
|
|
259
|
+
meter: 1,
|
|
260
|
+
noscript: 1,
|
|
261
|
+
object: 1,
|
|
262
|
+
output: 1,
|
|
263
|
+
progress: 1,
|
|
264
|
+
q: 1,
|
|
265
|
+
ruby: 1,
|
|
266
|
+
s: 1,
|
|
267
|
+
samp: 1,
|
|
268
|
+
script: 1,
|
|
269
|
+
select: 1,
|
|
270
|
+
small: 1,
|
|
271
|
+
span: 1,
|
|
272
|
+
strong: 1,
|
|
273
|
+
sub: 1,
|
|
274
|
+
sup: 1,
|
|
275
|
+
textarea: 1,
|
|
276
|
+
time: 1,
|
|
277
|
+
u: 1,
|
|
278
|
+
var: 1,
|
|
279
|
+
video: 1,
|
|
280
|
+
wbr: 1
|
|
281
|
+
},
|
|
282
|
+
// F - PF (Flow Only).
|
|
283
|
+
FO = {
|
|
284
|
+
address: 1,
|
|
285
|
+
article: 1,
|
|
286
|
+
aside: 1,
|
|
287
|
+
blockquote: 1,
|
|
288
|
+
details: 1,
|
|
289
|
+
div: 1,
|
|
290
|
+
dl: 1,
|
|
291
|
+
fieldset: 1,
|
|
292
|
+
figure: 1,
|
|
293
|
+
footer: 1,
|
|
294
|
+
form: 1,
|
|
295
|
+
h1: 1,
|
|
296
|
+
h2: 1,
|
|
297
|
+
h3: 1,
|
|
298
|
+
h4: 1,
|
|
299
|
+
h5: 1,
|
|
300
|
+
h6: 1,
|
|
301
|
+
header: 1,
|
|
302
|
+
hgroup: 1,
|
|
303
|
+
hr: 1,
|
|
304
|
+
menu: 1,
|
|
305
|
+
nav: 1,
|
|
306
|
+
ol: 1,
|
|
307
|
+
p: 1,
|
|
308
|
+
pre: 1,
|
|
309
|
+
section: 1,
|
|
310
|
+
table: 1,
|
|
311
|
+
ul: 1
|
|
312
|
+
},
|
|
313
|
+
// Metadata elements.
|
|
314
|
+
M = {
|
|
315
|
+
command: 1,
|
|
316
|
+
link: 1,
|
|
317
|
+
meta: 1,
|
|
318
|
+
noscript: 1,
|
|
319
|
+
script: 1,
|
|
320
|
+
style: 1
|
|
321
|
+
},
|
|
322
|
+
// Empty.
|
|
323
|
+
E = {},
|
|
324
|
+
// Text.
|
|
325
|
+
T = {
|
|
326
|
+
'#': 1
|
|
327
|
+
},
|
|
328
|
+
// Deprecated phrasing elements.
|
|
329
|
+
DP = {
|
|
330
|
+
acronym: 1,
|
|
331
|
+
applet: 1,
|
|
332
|
+
basefont: 1,
|
|
333
|
+
big: 1,
|
|
334
|
+
font: 1,
|
|
335
|
+
isindex: 1,
|
|
336
|
+
strike: 1,
|
|
337
|
+
style: 1,
|
|
338
|
+
tt: 1
|
|
339
|
+
}, // TODO remove "style".
|
|
340
|
+
// Deprecated flow only elements.
|
|
341
|
+
DFO = {
|
|
342
|
+
center: 1,
|
|
343
|
+
dir: 1,
|
|
344
|
+
noframes: 1
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
// Phrasing elements := PF + T + DP
|
|
348
|
+
X(P, PF, T, DP);
|
|
349
|
+
// Flow elements := FO + P + DFO
|
|
350
|
+
X(F, FO, P, DFO);
|
|
351
|
+
|
|
352
|
+
dtd = {
|
|
353
|
+
a: Y(P, {
|
|
354
|
+
a: 1,
|
|
355
|
+
button: 1
|
|
356
|
+
}), // Treat as normal inline element (not a transparent one).
|
|
357
|
+
abbr: P,
|
|
358
|
+
address: F,
|
|
359
|
+
area: E,
|
|
360
|
+
article: X(
|
|
361
|
+
{
|
|
362
|
+
style: 1
|
|
363
|
+
},
|
|
364
|
+
F
|
|
365
|
+
),
|
|
366
|
+
aside: X(
|
|
367
|
+
{
|
|
368
|
+
style: 1
|
|
369
|
+
},
|
|
370
|
+
F
|
|
371
|
+
),
|
|
372
|
+
audio: X(
|
|
373
|
+
{
|
|
374
|
+
source: 1,
|
|
375
|
+
track: 1
|
|
376
|
+
},
|
|
377
|
+
F
|
|
378
|
+
),
|
|
379
|
+
b: P,
|
|
380
|
+
base: E,
|
|
381
|
+
bdi: P,
|
|
382
|
+
bdo: P,
|
|
383
|
+
blockquote: F,
|
|
384
|
+
body: F,
|
|
385
|
+
br: E,
|
|
386
|
+
button: Y(P, {
|
|
387
|
+
a: 1,
|
|
388
|
+
button: 1
|
|
389
|
+
}),
|
|
390
|
+
canvas: P, // Treat as normal inline element (not a transparent one).
|
|
391
|
+
caption: F,
|
|
392
|
+
cite: P,
|
|
393
|
+
code: P,
|
|
394
|
+
col: E,
|
|
395
|
+
colgroup: {
|
|
396
|
+
col: 1
|
|
397
|
+
},
|
|
398
|
+
command: E,
|
|
399
|
+
datalist: X(
|
|
400
|
+
{
|
|
401
|
+
option: 1
|
|
402
|
+
},
|
|
403
|
+
P
|
|
404
|
+
),
|
|
405
|
+
dd: F,
|
|
406
|
+
del: P, // Treat as normal inline element (not a transparent one).
|
|
407
|
+
details: X(
|
|
408
|
+
{
|
|
409
|
+
summary: 1
|
|
410
|
+
},
|
|
411
|
+
F
|
|
412
|
+
),
|
|
413
|
+
dfn: P,
|
|
414
|
+
div: X(
|
|
415
|
+
{
|
|
416
|
+
style: 1
|
|
417
|
+
},
|
|
418
|
+
F
|
|
419
|
+
),
|
|
420
|
+
dl: {
|
|
421
|
+
dt: 1,
|
|
422
|
+
dd: 1
|
|
423
|
+
},
|
|
424
|
+
dt: F,
|
|
425
|
+
em: P,
|
|
426
|
+
embed: E,
|
|
427
|
+
fieldset: X(
|
|
428
|
+
{
|
|
429
|
+
legend: 1
|
|
430
|
+
},
|
|
431
|
+
F
|
|
432
|
+
),
|
|
433
|
+
figcaption: F,
|
|
434
|
+
figure: X(
|
|
435
|
+
{
|
|
436
|
+
figcaption: 1
|
|
437
|
+
},
|
|
438
|
+
F
|
|
439
|
+
),
|
|
440
|
+
footer: F,
|
|
441
|
+
form: F,
|
|
442
|
+
h1: P,
|
|
443
|
+
h2: P,
|
|
444
|
+
h3: P,
|
|
445
|
+
h4: P,
|
|
446
|
+
h5: P,
|
|
447
|
+
h6: P,
|
|
448
|
+
head: X(
|
|
449
|
+
{
|
|
450
|
+
title: 1,
|
|
451
|
+
base: 1
|
|
452
|
+
},
|
|
453
|
+
M
|
|
454
|
+
),
|
|
455
|
+
header: F,
|
|
456
|
+
hgroup: {
|
|
457
|
+
h1: 1,
|
|
458
|
+
h2: 1,
|
|
459
|
+
h3: 1,
|
|
460
|
+
h4: 1,
|
|
461
|
+
h5: 1,
|
|
462
|
+
h6: 1
|
|
463
|
+
},
|
|
464
|
+
hr: E,
|
|
465
|
+
html: X(
|
|
466
|
+
{
|
|
467
|
+
head: 1,
|
|
468
|
+
body: 1
|
|
469
|
+
},
|
|
470
|
+
F,
|
|
471
|
+
M
|
|
472
|
+
), // Head and body are optional...
|
|
473
|
+
i: P,
|
|
474
|
+
iframe: T,
|
|
475
|
+
img: E,
|
|
476
|
+
input: E,
|
|
477
|
+
ins: P, // Treat as normal inline element (not a transparent one).
|
|
478
|
+
kbd: P,
|
|
479
|
+
keygen: E,
|
|
480
|
+
label: P,
|
|
481
|
+
legend: P,
|
|
482
|
+
li: F,
|
|
483
|
+
link: E,
|
|
484
|
+
map: F,
|
|
485
|
+
mark: P, // Treat as normal inline element (not a transparent one).
|
|
486
|
+
menu: X(
|
|
487
|
+
{
|
|
488
|
+
li: 1
|
|
489
|
+
},
|
|
490
|
+
F
|
|
491
|
+
),
|
|
492
|
+
meta: E,
|
|
493
|
+
meter: Y(P, {
|
|
494
|
+
meter: 1
|
|
495
|
+
}),
|
|
496
|
+
nav: F,
|
|
497
|
+
noscript: X(
|
|
498
|
+
{
|
|
499
|
+
link: 1,
|
|
500
|
+
meta: 1,
|
|
501
|
+
style: 1
|
|
502
|
+
},
|
|
503
|
+
P
|
|
504
|
+
), // Treat as normal inline element (not a transparent one).
|
|
505
|
+
object: X(
|
|
506
|
+
{
|
|
507
|
+
param: 1
|
|
508
|
+
},
|
|
509
|
+
P
|
|
510
|
+
), // Treat as normal inline element (not a transparent one).
|
|
511
|
+
ol: {
|
|
512
|
+
li: 1
|
|
513
|
+
},
|
|
514
|
+
optgroup: {
|
|
515
|
+
option: 1
|
|
516
|
+
},
|
|
517
|
+
option: T,
|
|
518
|
+
output: P,
|
|
519
|
+
p: P,
|
|
520
|
+
param: E,
|
|
521
|
+
pre: P,
|
|
522
|
+
progress: Y(P, {
|
|
523
|
+
progress: 1
|
|
524
|
+
}),
|
|
525
|
+
q: P,
|
|
526
|
+
rp: P,
|
|
527
|
+
rt: P,
|
|
528
|
+
ruby: X(
|
|
529
|
+
{
|
|
530
|
+
rp: 1,
|
|
531
|
+
rt: 1
|
|
532
|
+
},
|
|
533
|
+
P
|
|
534
|
+
),
|
|
535
|
+
s: P,
|
|
536
|
+
samp: P,
|
|
537
|
+
script: T,
|
|
538
|
+
section: X(
|
|
539
|
+
{
|
|
540
|
+
style: 1
|
|
541
|
+
},
|
|
542
|
+
F
|
|
543
|
+
),
|
|
544
|
+
select: {
|
|
545
|
+
optgroup: 1,
|
|
546
|
+
option: 1
|
|
547
|
+
},
|
|
548
|
+
small: P,
|
|
549
|
+
source: E,
|
|
550
|
+
span: P,
|
|
551
|
+
strong: P,
|
|
552
|
+
style: T,
|
|
553
|
+
sub: P,
|
|
554
|
+
summary: P,
|
|
555
|
+
sup: P,
|
|
556
|
+
table: {
|
|
557
|
+
caption: 1,
|
|
558
|
+
colgroup: 1,
|
|
559
|
+
thead: 1,
|
|
560
|
+
tfoot: 1,
|
|
561
|
+
tbody: 1,
|
|
562
|
+
tr: 1
|
|
563
|
+
},
|
|
564
|
+
tbody: {
|
|
565
|
+
tr: 1
|
|
566
|
+
},
|
|
567
|
+
td: F,
|
|
568
|
+
textarea: T,
|
|
569
|
+
tfoot: {
|
|
570
|
+
tr: 1
|
|
571
|
+
},
|
|
572
|
+
th: F,
|
|
573
|
+
thead: {
|
|
574
|
+
tr: 1
|
|
575
|
+
},
|
|
576
|
+
time: Y(P, {
|
|
577
|
+
time: 1
|
|
578
|
+
}),
|
|
579
|
+
title: T,
|
|
580
|
+
tr: {
|
|
581
|
+
th: 1,
|
|
582
|
+
td: 1
|
|
583
|
+
},
|
|
584
|
+
track: E,
|
|
585
|
+
u: P,
|
|
586
|
+
ul: {
|
|
587
|
+
li: 1
|
|
588
|
+
},
|
|
589
|
+
var: P,
|
|
590
|
+
video: X(
|
|
591
|
+
{
|
|
592
|
+
source: 1,
|
|
593
|
+
track: 1
|
|
594
|
+
},
|
|
595
|
+
F
|
|
596
|
+
),
|
|
597
|
+
wbr: E,
|
|
598
|
+
|
|
599
|
+
// Deprecated tags.
|
|
600
|
+
acronym: P,
|
|
601
|
+
applet: X(
|
|
602
|
+
{
|
|
603
|
+
param: 1
|
|
604
|
+
},
|
|
605
|
+
F
|
|
606
|
+
),
|
|
607
|
+
basefont: E,
|
|
608
|
+
big: P,
|
|
609
|
+
center: F,
|
|
610
|
+
dialog: E,
|
|
611
|
+
dir: {
|
|
612
|
+
li: 1
|
|
613
|
+
},
|
|
614
|
+
font: P,
|
|
615
|
+
isindex: E,
|
|
616
|
+
noframes: F,
|
|
617
|
+
strike: P,
|
|
618
|
+
tt: P
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
X(dtd, {
|
|
622
|
+
/**
|
|
623
|
+
* List of block elements, like `<p>` or `<div>`.
|
|
624
|
+
*/
|
|
625
|
+
$block: X(
|
|
626
|
+
{
|
|
627
|
+
audio: 1,
|
|
628
|
+
dd: 1,
|
|
629
|
+
dt: 1,
|
|
630
|
+
figcaption: 1,
|
|
631
|
+
li: 1,
|
|
632
|
+
video: 1
|
|
633
|
+
},
|
|
634
|
+
FO,
|
|
635
|
+
DFO
|
|
636
|
+
),
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* List of elements that contain other blocks, in which block-level operations should be limited,
|
|
640
|
+
* this property is not intended to be checked directly, use {@link CKEDITOR.dom.elementPath#blockLimit} instead.
|
|
641
|
+
*
|
|
642
|
+
* Some examples of editor behaviors that are impacted by block limits:
|
|
643
|
+
*
|
|
644
|
+
* * Enter key never split a block-limit element;
|
|
645
|
+
* * Style application is constraint by the block limit of the current selection.
|
|
646
|
+
* * Pasted html will be inserted into the block limit of the current selection.
|
|
647
|
+
*
|
|
648
|
+
* **Note:** As an exception `<li>` is not considered as a block limit, as it's generally used as a text block.
|
|
649
|
+
*/
|
|
650
|
+
$blockLimit: {
|
|
651
|
+
article: 1,
|
|
652
|
+
aside: 1,
|
|
653
|
+
audio: 1,
|
|
654
|
+
body: 1,
|
|
655
|
+
caption: 1,
|
|
656
|
+
details: 1,
|
|
657
|
+
dir: 1,
|
|
658
|
+
div: 1,
|
|
659
|
+
dl: 1,
|
|
660
|
+
fieldset: 1,
|
|
661
|
+
figcaption: 1,
|
|
662
|
+
figure: 1,
|
|
663
|
+
footer: 1,
|
|
664
|
+
form: 1,
|
|
665
|
+
header: 1,
|
|
666
|
+
hgroup: 1,
|
|
667
|
+
menu: 1,
|
|
668
|
+
nav: 1,
|
|
669
|
+
ol: 1,
|
|
670
|
+
section: 1,
|
|
671
|
+
table: 1,
|
|
672
|
+
td: 1,
|
|
673
|
+
th: 1,
|
|
674
|
+
tr: 1,
|
|
675
|
+
ul: 1,
|
|
676
|
+
video: 1
|
|
677
|
+
},
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* List of elements that contain character data.
|
|
681
|
+
*/
|
|
682
|
+
$cdata: {
|
|
683
|
+
script: 1,
|
|
684
|
+
style: 1
|
|
685
|
+
},
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* List of elements that are accepted as inline editing hosts.
|
|
689
|
+
*/
|
|
690
|
+
$editable: {
|
|
691
|
+
address: 1,
|
|
692
|
+
article: 1,
|
|
693
|
+
aside: 1,
|
|
694
|
+
blockquote: 1,
|
|
695
|
+
body: 1,
|
|
696
|
+
details: 1,
|
|
697
|
+
div: 1,
|
|
698
|
+
fieldset: 1,
|
|
699
|
+
figcaption: 1,
|
|
700
|
+
footer: 1,
|
|
701
|
+
form: 1,
|
|
702
|
+
h1: 1,
|
|
703
|
+
h2: 1,
|
|
704
|
+
h3: 1,
|
|
705
|
+
h4: 1,
|
|
706
|
+
h5: 1,
|
|
707
|
+
h6: 1,
|
|
708
|
+
header: 1,
|
|
709
|
+
hgroup: 1,
|
|
710
|
+
nav: 1,
|
|
711
|
+
p: 1,
|
|
712
|
+
pre: 1,
|
|
713
|
+
section: 1,
|
|
714
|
+
table: 1
|
|
715
|
+
},
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* List of empty (self-closing) elements, like `<br>` or `<img>`.
|
|
719
|
+
*/
|
|
720
|
+
$empty: {
|
|
721
|
+
area: 1,
|
|
722
|
+
base: 1,
|
|
723
|
+
basefont: 1,
|
|
724
|
+
br: 1,
|
|
725
|
+
col: 1,
|
|
726
|
+
command: 1,
|
|
727
|
+
dialog: 1,
|
|
728
|
+
embed: 1,
|
|
729
|
+
hr: 1,
|
|
730
|
+
img: 1,
|
|
731
|
+
input: 1,
|
|
732
|
+
isindex: 1,
|
|
733
|
+
keygen: 1,
|
|
734
|
+
link: 1,
|
|
735
|
+
meta: 1,
|
|
736
|
+
param: 1,
|
|
737
|
+
source: 1,
|
|
738
|
+
track: 1,
|
|
739
|
+
wbr: 1
|
|
740
|
+
},
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* List of inline (`<span>` like) elements.
|
|
744
|
+
*/
|
|
745
|
+
$inline: P,
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* List of list root elements.
|
|
749
|
+
*/
|
|
750
|
+
$list: {
|
|
751
|
+
dl: 1,
|
|
752
|
+
ol: 1,
|
|
753
|
+
ul: 1
|
|
754
|
+
},
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* List of list item elements, like `<li>` or `<dd>`.
|
|
758
|
+
*/
|
|
759
|
+
$listItem: {
|
|
760
|
+
dd: 1,
|
|
761
|
+
dt: 1,
|
|
762
|
+
li: 1
|
|
763
|
+
},
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* List of elements which may live outside body.
|
|
767
|
+
*/
|
|
768
|
+
$nonBodyContent: X(
|
|
769
|
+
{
|
|
770
|
+
body: 1,
|
|
771
|
+
head: 1,
|
|
772
|
+
html: 1
|
|
773
|
+
},
|
|
774
|
+
dtd.head
|
|
775
|
+
),
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Elements that accept text nodes, but are not possible to edit into the browser.
|
|
779
|
+
*/
|
|
780
|
+
$nonEditable: {
|
|
781
|
+
applet: 1,
|
|
782
|
+
audio: 1,
|
|
783
|
+
button: 1,
|
|
784
|
+
embed: 1,
|
|
785
|
+
iframe: 1,
|
|
786
|
+
map: 1,
|
|
787
|
+
object: 1,
|
|
788
|
+
option: 1,
|
|
789
|
+
param: 1,
|
|
790
|
+
script: 1,
|
|
791
|
+
textarea: 1,
|
|
792
|
+
video: 1
|
|
793
|
+
},
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Elements that are considered objects, therefore selected as a whole in the editor.
|
|
797
|
+
*/
|
|
798
|
+
$object: {
|
|
799
|
+
applet: 1,
|
|
800
|
+
audio: 1,
|
|
801
|
+
button: 1,
|
|
802
|
+
hr: 1,
|
|
803
|
+
iframe: 1,
|
|
804
|
+
img: 1,
|
|
805
|
+
input: 1,
|
|
806
|
+
object: 1,
|
|
807
|
+
select: 1,
|
|
808
|
+
table: 1,
|
|
809
|
+
textarea: 1,
|
|
810
|
+
video: 1
|
|
811
|
+
},
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* List of elements that can be ignored if empty, like `<b>` or `<span>`.
|
|
815
|
+
*/
|
|
816
|
+
$removeEmpty: {
|
|
817
|
+
abbr: 1,
|
|
818
|
+
acronym: 1,
|
|
819
|
+
b: 1,
|
|
820
|
+
bdi: 1,
|
|
821
|
+
bdo: 1,
|
|
822
|
+
big: 1,
|
|
823
|
+
cite: 1,
|
|
824
|
+
code: 1,
|
|
825
|
+
del: 1,
|
|
826
|
+
dfn: 1,
|
|
827
|
+
em: 1,
|
|
828
|
+
font: 1,
|
|
829
|
+
i: 1,
|
|
830
|
+
ins: 1,
|
|
831
|
+
label: 1,
|
|
832
|
+
kbd: 1,
|
|
833
|
+
mark: 1,
|
|
834
|
+
meter: 1,
|
|
835
|
+
output: 1,
|
|
836
|
+
q: 1,
|
|
837
|
+
ruby: 1,
|
|
838
|
+
s: 1,
|
|
839
|
+
samp: 1,
|
|
840
|
+
small: 1,
|
|
841
|
+
span: 1,
|
|
842
|
+
strike: 1,
|
|
843
|
+
strong: 1,
|
|
844
|
+
sub: 1,
|
|
845
|
+
sup: 1,
|
|
846
|
+
time: 1,
|
|
847
|
+
tt: 1,
|
|
848
|
+
u: 1,
|
|
849
|
+
var: 1
|
|
850
|
+
},
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* List of elements that have tabindex set to zero by default.
|
|
854
|
+
*/
|
|
855
|
+
$tabIndex: {
|
|
856
|
+
a: 1,
|
|
857
|
+
area: 1,
|
|
858
|
+
button: 1,
|
|
859
|
+
input: 1,
|
|
860
|
+
object: 1,
|
|
861
|
+
select: 1,
|
|
862
|
+
textarea: 1
|
|
863
|
+
},
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* List of elements used inside the `<table>` element, like `<tbody>` or `<td>`.
|
|
867
|
+
*/
|
|
868
|
+
$tableContent: {
|
|
869
|
+
caption: 1,
|
|
870
|
+
col: 1,
|
|
871
|
+
colgroup: 1,
|
|
872
|
+
tbody: 1,
|
|
873
|
+
td: 1,
|
|
874
|
+
tfoot: 1,
|
|
875
|
+
th: 1,
|
|
876
|
+
thead: 1,
|
|
877
|
+
tr: 1
|
|
878
|
+
},
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* List of "transparent" elements. See [W3C's definition of "transparent" element](http://dev.w3.org/html5/markup/terminology.html#transparent).
|
|
882
|
+
*/
|
|
883
|
+
$transparent: {
|
|
884
|
+
a: 1,
|
|
885
|
+
audio: 1,
|
|
886
|
+
canvas: 1,
|
|
887
|
+
del: 1,
|
|
888
|
+
ins: 1,
|
|
889
|
+
map: 1,
|
|
890
|
+
noscript: 1,
|
|
891
|
+
object: 1,
|
|
892
|
+
video: 1
|
|
893
|
+
},
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* List of elements that are not to exist standalone that must live under its parent element.
|
|
897
|
+
*/
|
|
898
|
+
$intermediate: {
|
|
899
|
+
caption: 1,
|
|
900
|
+
colgroup: 1,
|
|
901
|
+
dd: 1,
|
|
902
|
+
dt: 1,
|
|
903
|
+
figcaption: 1,
|
|
904
|
+
legend: 1,
|
|
905
|
+
li: 1,
|
|
906
|
+
optgroup: 1,
|
|
907
|
+
option: 1,
|
|
908
|
+
rp: 1,
|
|
909
|
+
rt: 1,
|
|
910
|
+
summary: 1,
|
|
911
|
+
tbody: 1,
|
|
912
|
+
td: 1,
|
|
913
|
+
tfoot: 1,
|
|
914
|
+
th: 1,
|
|
915
|
+
thead: 1,
|
|
916
|
+
tr: 1
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
return dtd;
|
|
921
|
+
})();
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Applies QTI rules to a copy of the xhtmlDtd
|
|
925
|
+
*
|
|
926
|
+
* @return dtd {object} the modified dtd
|
|
927
|
+
*/
|
|
928
|
+
dtds.qti = (function () {
|
|
929
|
+
var element,
|
|
930
|
+
listCnt,
|
|
931
|
+
child,
|
|
932
|
+
actions = ['remove', 'add'],
|
|
933
|
+
actCnt,
|
|
934
|
+
actLnt = actions.length,
|
|
935
|
+
action,
|
|
936
|
+
overrides = {
|
|
937
|
+
pre: {
|
|
938
|
+
add: [],
|
|
939
|
+
remove: ['img', 'object', 'big', 'small', 'sub', 'sup']
|
|
940
|
+
},
|
|
941
|
+
table: {
|
|
942
|
+
remove: ['col']
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
qtiDtd = _.cloneDeep(dtds.html),
|
|
946
|
+
tmp,
|
|
947
|
+
h5Len = html5Only.length,
|
|
948
|
+
intersection;
|
|
949
|
+
|
|
950
|
+
// remove html5-only keys
|
|
951
|
+
while (h5Len--) {
|
|
952
|
+
delete qtiDtd[html5Only[h5Len]];
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// find html5-only elements in children and add them to overrides
|
|
956
|
+
for (element in qtiDtd) {
|
|
957
|
+
if (!Object.prototype.hasOwnProperty.call(qtiDtd, element)) {
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
intersection = _.intersection(_.keys(qtiDtd[element]), html5Only);
|
|
961
|
+
if (!intersection.length) {
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
if (!overrides[element]) {
|
|
965
|
+
overrides[element] = {
|
|
966
|
+
remove: []
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
overrides[element].remove = overrides[element].remove.concat(intersection);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// execute overrides
|
|
973
|
+
for (element in overrides) {
|
|
974
|
+
if (!Object.prototype.hasOwnProperty.call(overrides, element)) {
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
// disallow adding keys to the dtd ckeditor cannot handle
|
|
978
|
+
if (!Object.prototype.hasOwnProperty.call(qtiDtd, element)) {
|
|
979
|
+
continue;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// note: removing and adding is on purpose done in two steps
|
|
983
|
+
for (actCnt = 0; actCnt < actLnt; actCnt++) {
|
|
984
|
+
action = actions[actCnt];
|
|
985
|
+
if (!(action in overrides[element])) {
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
listCnt = overrides[element][action].length;
|
|
989
|
+
|
|
990
|
+
// allow 'all' as a shortcut for 'remove all children'
|
|
991
|
+
if (action === 'remove' && overrides[element][action] === 'all') {
|
|
992
|
+
qtiDtd[element] = {};
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
// doggy style loop over children to add
|
|
997
|
+
while (listCnt--) {
|
|
998
|
+
child = overrides[element][action][listCnt];
|
|
999
|
+
// there was some weird behaviour with references
|
|
1000
|
+
// deleting from pre would also delete from p
|
|
1001
|
+
// going over a tmp var solves this, though I have no idea why
|
|
1002
|
+
tmp = _.cloneDeep(qtiDtd[element]);
|
|
1003
|
+
if (action === 'remove') {
|
|
1004
|
+
delete tmp[child];
|
|
1005
|
+
qtiDtd[element] = tmp;
|
|
1006
|
+
}
|
|
1007
|
+
// add child element to element as long as it's not entirely unknown to ckeditor
|
|
1008
|
+
else if (action === 'add' && typeof qtiDtd[child] !== 'undefined') {
|
|
1009
|
+
tmp[child] = 1;
|
|
1010
|
+
qtiDtd[element] = tmp[child];
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
return qtiDtd;
|
|
1017
|
+
})();
|
|
1018
|
+
|
|
1019
|
+
return {
|
|
1020
|
+
getDtd: getDtd,
|
|
1021
|
+
getChildrenOf: getChildrenOf,
|
|
1022
|
+
getParentsOf: getParentsOf,
|
|
1023
|
+
isChildOf: isChildOf,
|
|
1024
|
+
isParentOf: isParentOf,
|
|
1025
|
+
getMode: getMode,
|
|
1026
|
+
setMode: setMode
|
|
1027
|
+
};
|
|
1028
|
+
})();
|
|
1029
|
+
|
|
1030
|
+
export default dtdHandler;
|