suneditor 3.0.0-beta.9 → 3.0.0-rc.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/README.md +65 -57
- package/dist/suneditor-contents.min.css +1 -0
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +110 -61
- package/src/assets/design/color.css +36 -17
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +17 -2
- package/src/assets/suneditor-contents.css +51 -16
- package/src/assets/suneditor.css +116 -43
- package/src/core/config/contextProvider.js +288 -0
- package/src/core/config/eventManager.js +188 -0
- package/src/core/config/instanceCheck.js +59 -0
- package/src/core/config/optionProvider.js +452 -0
- package/src/core/editor.js +166 -1637
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +74 -0
- package/src/core/event/effects/keydown.registry.js +573 -0
- package/src/core/event/effects/ruleHelpers.js +148 -0
- package/src/core/event/eventOrchestrator.js +944 -0
- package/src/core/event/executor.js +27 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +27 -28
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +10 -8
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +22 -23
- package/src/core/event/handlers/handler_ww_input.js +75 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/event/handlers/handler_ww_mouse.js +166 -0
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +97 -0
- package/src/core/event/rules/keydown.rule.arrow.js +63 -0
- package/src/core/event/rules/keydown.rule.backspace.js +208 -0
- package/src/core/event/rules/keydown.rule.delete.js +132 -0
- package/src/core/event/rules/keydown.rule.enter.js +150 -0
- package/src/core/event/rules/keydown.rule.tab.js +35 -0
- package/src/core/event/support/defaultLineManager.js +136 -0
- package/src/core/event/support/selectionState.js +204 -0
- package/src/core/kernel/coreKernel.js +320 -0
- package/src/core/kernel/kernelInjector.js +19 -0
- package/src/core/kernel/store.js +173 -0
- package/src/core/{class → logic/dom}/char.js +42 -45
- package/src/core/logic/dom/format.js +1075 -0
- package/src/core/{class → logic/dom}/html.js +743 -624
- package/src/core/logic/dom/inline.js +1847 -0
- package/src/core/logic/dom/listFormat.js +601 -0
- package/src/core/{class → logic/dom}/nodeTransform.js +92 -72
- package/src/core/{class → logic/dom}/offset.js +254 -317
- package/src/core/logic/dom/selection.js +754 -0
- package/src/core/logic/panel/menu.js +389 -0
- package/src/core/logic/panel/toolbar.js +449 -0
- package/src/core/logic/panel/viewer.js +761 -0
- package/src/core/logic/shell/_commandExecutor.js +380 -0
- package/src/core/logic/shell/commandDispatcher.js +241 -0
- package/src/core/logic/shell/component.js +970 -0
- package/src/core/logic/shell/focusManager.js +110 -0
- package/src/core/{base → logic/shell}/history.js +110 -60
- package/src/core/logic/shell/pluginManager.js +363 -0
- package/src/core/logic/shell/shortcuts.js +130 -0
- package/src/core/logic/shell/ui.js +904 -0
- package/src/core/schema/context.js +66 -0
- package/src/core/schema/frameContext.js +160 -0
- package/src/core/schema/options.js +628 -0
- package/src/core/section/constructor.js +194 -500
- package/src/core/section/documentType.js +297 -222
- package/src/events.js +808 -543
- package/src/helper/clipboard.js +27 -16
- package/src/helper/converter.js +100 -78
- package/src/helper/dom/domCheck.js +56 -30
- package/src/helper/dom/domQuery.js +159 -89
- package/src/helper/dom/domUtils.js +114 -49
- package/src/helper/dom/index.js +5 -1
- package/src/helper/env.js +26 -26
- package/src/helper/index.js +1 -1
- package/src/helper/keyCodeMap.js +25 -28
- package/src/helper/numbers.js +4 -8
- package/src/helper/unicode.js +4 -8
- package/src/hooks/base.js +307 -0
- package/src/hooks/params.js +130 -0
- package/src/interfaces/contracts.js +227 -0
- package/src/interfaces/index.js +7 -0
- package/src/interfaces/plugins.js +239 -0
- package/src/langs/ckb.js +4 -4
- package/src/langs/cs.js +4 -4
- package/src/langs/da.js +4 -4
- package/src/langs/de.js +4 -4
- package/src/langs/en.js +4 -4
- package/src/langs/es.js +4 -4
- package/src/langs/fa.js +4 -4
- package/src/langs/fr.js +4 -4
- package/src/langs/he.js +4 -4
- package/src/langs/hu.js +4 -4
- package/src/langs/it.js +4 -4
- package/src/langs/ja.js +4 -4
- package/src/langs/km.js +4 -4
- package/src/langs/ko.js +4 -4
- package/src/langs/lv.js +4 -4
- package/src/langs/nl.js +4 -4
- package/src/langs/pl.js +4 -4
- package/src/langs/pt_br.js +13 -13
- package/src/langs/ro.js +4 -4
- package/src/langs/ru.js +4 -4
- package/src/langs/se.js +4 -4
- package/src/langs/tr.js +4 -4
- package/src/langs/uk.js +4 -4
- package/src/langs/ur.js +4 -4
- package/src/langs/zh_cn.js +4 -4
- package/src/modules/{Browser.js → contract/Browser.js} +119 -128
- package/src/modules/{ColorPicker.js → contract/ColorPicker.js} +132 -142
- package/src/modules/contract/Controller.js +589 -0
- package/src/modules/{Figure.js → contract/Figure.js} +591 -411
- package/src/modules/{HueSlider.js → contract/HueSlider.js} +125 -86
- package/src/modules/contract/Modal.js +357 -0
- package/src/modules/contract/index.js +9 -0
- package/src/modules/manager/ApiManager.js +197 -0
- package/src/modules/{FileManager.js → manager/FileManager.js} +128 -160
- package/src/modules/manager/index.js +5 -0
- package/src/modules/{ModalAnchorEditor.js → ui/ModalAnchorEditor.js} +108 -138
- package/src/modules/{SelectMenu.js → ui/SelectMenu.js} +119 -120
- package/src/modules/{_DragHandle.js → ui/_DragHandle.js} +1 -1
- package/src/modules/ui/index.js +6 -0
- package/src/plugins/browser/audioGallery.js +23 -26
- package/src/plugins/browser/fileBrowser.js +25 -28
- package/src/plugins/browser/fileGallery.js +20 -23
- package/src/plugins/browser/imageGallery.js +24 -23
- package/src/plugins/browser/videoGallery.js +27 -29
- package/src/plugins/command/blockquote.js +11 -17
- package/src/plugins/command/exportPDF.js +26 -26
- package/src/plugins/command/fileUpload.js +138 -133
- package/src/plugins/command/list_bulleted.js +48 -44
- package/src/plugins/command/list_numbered.js +48 -44
- package/src/plugins/dropdown/align.js +64 -50
- package/src/plugins/dropdown/backgroundColor.js +34 -35
- package/src/plugins/dropdown/{formatBlock.js → blockStyle.js} +43 -37
- package/src/plugins/dropdown/font.js +50 -36
- package/src/plugins/dropdown/fontColor.js +34 -35
- package/src/plugins/dropdown/hr.js +55 -50
- package/src/plugins/dropdown/layout.js +20 -15
- package/src/plugins/dropdown/lineHeight.js +46 -30
- package/src/plugins/dropdown/list.js +32 -33
- package/src/plugins/dropdown/paragraphStyle.js +40 -34
- package/src/plugins/dropdown/table/index.js +915 -0
- package/src/plugins/dropdown/table/render/table.html.js +308 -0
- package/src/plugins/dropdown/table/render/table.menu.js +121 -0
- package/src/plugins/dropdown/table/services/table.cell.js +465 -0
- package/src/plugins/dropdown/table/services/table.clipboard.js +414 -0
- package/src/plugins/dropdown/table/services/table.grid.js +504 -0
- package/src/plugins/dropdown/table/services/table.resize.js +463 -0
- package/src/plugins/dropdown/table/services/table.selection.js +466 -0
- package/src/plugins/dropdown/table/services/table.style.js +844 -0
- package/src/plugins/dropdown/table/shared/table.constants.js +109 -0
- package/src/plugins/dropdown/table/shared/table.utils.js +219 -0
- package/src/plugins/dropdown/template.js +20 -15
- package/src/plugins/dropdown/textStyle.js +28 -22
- package/src/plugins/field/mention.js +54 -49
- package/src/plugins/index.js +5 -5
- package/src/plugins/input/fontSize.js +100 -97
- package/src/plugins/input/pageNavigator.js +13 -10
- package/src/plugins/modal/audio.js +208 -219
- package/src/plugins/modal/drawing.js +99 -104
- package/src/plugins/modal/embed.js +323 -312
- package/src/plugins/modal/image/index.js +942 -0
- package/src/plugins/modal/image/render/image.html.js +150 -0
- package/src/plugins/modal/image/services/image.size.js +198 -0
- package/src/plugins/modal/image/services/image.upload.js +216 -0
- package/src/plugins/modal/image/shared/image.constants.js +20 -0
- package/src/plugins/modal/link.js +74 -54
- package/src/plugins/modal/math.js +126 -119
- package/src/plugins/modal/video/index.js +858 -0
- package/src/plugins/modal/video/render/video.html.js +131 -0
- package/src/plugins/modal/video/services/video.size.js +281 -0
- package/src/plugins/modal/video/services/video.upload.js +92 -0
- package/src/plugins/popup/anchor.js +57 -49
- package/src/suneditor.js +73 -61
- package/src/themes/cobalt.css +155 -0
- package/src/themes/dark.css +143 -120
- package/src/typedef.js +214 -63
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/assets/suneditor-contents.css.d.ts +1 -0
- package/types/assets/suneditor.css.d.ts +1 -0
- package/types/core/config/contextProvider.d.ts +148 -0
- package/types/core/config/eventManager.d.ts +68 -0
- package/types/core/config/instanceCheck.d.ts +33 -0
- package/types/core/config/optionProvider.d.ts +147 -0
- package/types/core/editor.d.ts +27 -586
- package/types/core/event/actions/index.d.ts +50 -0
- package/types/core/event/effects/common.registry.d.ts +56 -0
- package/types/core/event/effects/keydown.registry.d.ts +80 -0
- package/types/core/event/effects/ruleHelpers.d.ts +36 -0
- package/types/core/event/eventOrchestrator.d.ts +191 -0
- package/types/core/event/executor.d.ts +13 -0
- package/types/core/event/handlers/handler_toolbar.d.ts +38 -0
- package/types/core/event/handlers/handler_ww_clipboard.d.ts +36 -0
- package/types/core/event/handlers/handler_ww_dragDrop.d.ts +26 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +38 -0
- package/types/core/event/handlers/handler_ww_key.d.ts +40 -0
- package/types/core/event/handlers/handler_ww_mouse.d.ts +47 -0
- package/types/core/event/ports.d.ts +256 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +84 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +19 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +18 -0
- package/types/core/event/support/defaultLineManager.d.ts +22 -0
- package/types/core/event/support/selectionState.d.ts +29 -0
- package/types/core/kernel/coreKernel.d.ts +219 -0
- package/types/core/kernel/kernelInjector.d.ts +16 -0
- package/types/core/kernel/store.d.ts +170 -0
- package/types/core/logic/dom/char.d.ts +46 -0
- package/types/core/logic/dom/format.d.ts +234 -0
- package/types/core/logic/dom/html.d.ts +290 -0
- package/types/core/logic/dom/inline.d.ts +93 -0
- package/types/core/logic/dom/listFormat.d.ts +101 -0
- package/types/core/logic/dom/nodeTransform.d.ts +110 -0
- package/types/core/logic/dom/offset.d.ts +335 -0
- package/types/core/logic/dom/selection.d.ts +165 -0
- package/types/core/logic/panel/menu.d.ts +93 -0
- package/types/core/logic/panel/toolbar.d.ts +128 -0
- package/types/core/logic/panel/viewer.d.ts +89 -0
- package/types/core/logic/shell/_commandExecutor.d.ts +18 -0
- package/types/core/logic/shell/commandDispatcher.d.ts +65 -0
- package/types/core/logic/shell/component.d.ts +182 -0
- package/types/core/logic/shell/focusManager.d.ts +31 -0
- package/types/core/{base → logic/shell}/history.d.ts +13 -12
- package/types/core/logic/shell/pluginManager.d.ts +115 -0
- package/types/core/logic/shell/shortcuts.d.ts +131 -0
- package/types/core/logic/shell/ui.d.ts +261 -0
- package/types/core/schema/context.d.ts +104 -0
- package/types/core/schema/frameContext.d.ts +320 -0
- package/types/core/schema/options.d.ts +1241 -0
- package/types/core/section/constructor.d.ts +117 -652
- package/types/core/section/documentType.d.ts +43 -61
- package/types/events.d.ts +796 -65
- package/types/helper/clipboard.d.ts +5 -4
- package/types/helper/converter.d.ts +55 -43
- package/types/helper/dom/domCheck.d.ts +27 -19
- package/types/helper/dom/domQuery.d.ts +76 -57
- package/types/helper/dom/domUtils.d.ts +62 -39
- package/types/helper/dom/index.d.ts +87 -1
- package/types/helper/env.d.ts +16 -13
- package/types/helper/index.d.ts +8 -2
- package/types/helper/keyCodeMap.d.ts +24 -23
- package/types/helper/numbers.d.ts +4 -6
- package/types/helper/unicode.d.ts +4 -3
- package/types/hooks/base.d.ts +239 -0
- package/types/hooks/params.d.ts +65 -0
- package/types/index.d.ts +20 -117
- package/types/interfaces/contracts.d.ts +183 -0
- package/types/interfaces/index.d.ts +3 -0
- package/types/interfaces/plugins.d.ts +168 -0
- package/types/langs/_Lang.d.ts +2 -2
- package/types/langs/index.d.ts +2 -2
- package/types/modules/contract/Browser.d.ts +262 -0
- package/types/modules/contract/ColorPicker.d.ts +99 -0
- package/types/modules/contract/Controller.d.ts +204 -0
- package/types/modules/contract/Figure.d.ts +529 -0
- package/types/modules/{HueSlider.d.ts → contract/HueSlider.d.ts} +39 -28
- package/types/modules/contract/Modal.d.ts +62 -0
- package/types/modules/contract/index.d.ts +7 -0
- package/types/modules/manager/ApiManager.d.ts +106 -0
- package/types/modules/manager/FileManager.d.ts +124 -0
- package/types/modules/manager/index.d.ts +3 -0
- package/types/modules/ui/ModalAnchorEditor.d.ts +152 -0
- package/types/modules/ui/SelectMenu.d.ts +107 -0
- package/types/modules/{_DragHandle.d.ts → ui/_DragHandle.d.ts} +1 -0
- package/types/modules/ui/index.d.ts +4 -0
- package/types/plugins/browser/audioGallery.d.ts +33 -41
- package/types/plugins/browser/fileBrowser.d.ts +42 -50
- package/types/plugins/browser/fileGallery.d.ts +33 -41
- package/types/plugins/browser/imageGallery.d.ts +30 -37
- package/types/plugins/browser/videoGallery.d.ts +33 -41
- package/types/plugins/command/blockquote.d.ts +4 -21
- package/types/plugins/command/exportPDF.d.ts +23 -33
- package/types/plugins/command/fileUpload.d.ts +80 -100
- package/types/plugins/command/list_bulleted.d.ts +9 -35
- package/types/plugins/command/list_numbered.d.ts +9 -35
- package/types/plugins/dropdown/align.d.ts +23 -46
- package/types/plugins/dropdown/backgroundColor.d.ts +35 -53
- package/types/plugins/dropdown/blockStyle.d.ts +45 -0
- package/types/plugins/dropdown/font.d.ts +18 -41
- package/types/plugins/dropdown/fontColor.d.ts +35 -53
- package/types/plugins/dropdown/hr.d.ts +26 -52
- package/types/plugins/dropdown/layout.d.ts +19 -25
- package/types/plugins/dropdown/lineHeight.d.ts +21 -39
- package/types/plugins/dropdown/list.d.ts +6 -34
- package/types/plugins/dropdown/paragraphStyle.d.ts +34 -45
- package/types/plugins/dropdown/table/index.d.ts +158 -0
- package/types/plugins/dropdown/table/render/table.html.d.ts +71 -0
- package/types/plugins/dropdown/table/render/table.menu.d.ts +59 -0
- package/types/plugins/dropdown/table/services/table.cell.d.ts +76 -0
- package/types/plugins/dropdown/table/services/table.clipboard.d.ts +26 -0
- package/types/plugins/dropdown/table/services/table.grid.d.ts +77 -0
- package/types/plugins/dropdown/table/services/table.resize.d.ts +72 -0
- package/types/plugins/dropdown/table/services/table.selection.d.ts +59 -0
- package/types/plugins/dropdown/table/services/table.style.d.ts +162 -0
- package/types/plugins/dropdown/table/shared/table.constants.d.ts +134 -0
- package/types/plugins/dropdown/table/shared/table.utils.d.ts +91 -0
- package/types/plugins/dropdown/template.d.ts +19 -25
- package/types/plugins/dropdown/textStyle.d.ts +23 -30
- package/types/plugins/field/mention.d.ts +66 -72
- package/types/plugins/index.d.ts +41 -40
- package/types/plugins/input/fontSize.d.ts +57 -96
- package/types/plugins/input/pageNavigator.d.ts +5 -8
- package/types/plugins/modal/audio.d.ts +60 -153
- package/types/plugins/modal/drawing.d.ts +16 -118
- package/types/plugins/modal/embed.d.ts +46 -166
- package/types/plugins/modal/image/index.d.ts +281 -0
- package/types/plugins/modal/image/render/image.html.d.ts +45 -0
- package/types/plugins/modal/image/services/image.size.d.ts +55 -0
- package/types/plugins/modal/image/services/image.upload.d.ts +24 -0
- package/types/plugins/modal/image/shared/image.constants.d.ts +17 -0
- package/types/plugins/modal/link.d.ts +46 -66
- package/types/plugins/modal/math.d.ts +17 -86
- package/types/plugins/modal/{video.d.ts → video/index.d.ts} +89 -221
- package/types/plugins/modal/video/render/video.html.d.ts +37 -0
- package/types/plugins/modal/video/services/video.size.d.ts +74 -0
- package/types/plugins/modal/video/services/video.upload.d.ts +19 -0
- package/types/plugins/popup/anchor.d.ts +8 -38
- package/types/suneditor.d.ts +55 -24
- package/types/typedef.d.ts +344 -228
- package/CONTRIBUTING.md +0 -186
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/base/eventHandlers/handler_ww_mouse.js +0 -194
- package/src/core/base/eventManager.js +0 -1523
- package/src/core/class/component.js +0 -856
- package/src/core/class/format.js +0 -3433
- package/src/core/class/menu.js +0 -346
- package/src/core/class/selection.js +0 -610
- package/src/core/class/shortcuts.js +0 -98
- package/src/core/class/toolbar.js +0 -431
- package/src/core/class/ui.js +0 -424
- package/src/core/class/viewer.js +0 -750
- package/src/core/section/actives.js +0 -266
- package/src/core/section/context.js +0 -102
- package/src/editorInjector/_classes.js +0 -36
- package/src/editorInjector/_core.js +0 -87
- package/src/editorInjector/index.js +0 -73
- package/src/modules/ApiManager.js +0 -191
- package/src/modules/Controller.js +0 -474
- package/src/modules/Modal.js +0 -346
- package/src/modules/index.js +0 -14
- package/src/plugins/dropdown/table.js +0 -4034
- package/src/plugins/modal/image.js +0 -1376
- package/src/plugins/modal/video.js +0 -1226
- package/types/core/base/eventHandlers/handler_toolbar.d.ts +0 -41
- package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +0 -40
- package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +0 -35
- package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +0 -45
- package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +0 -39
- package/types/core/base/eventManager.d.ts +0 -401
- package/types/core/class/char.d.ts +0 -61
- package/types/core/class/component.d.ts +0 -213
- package/types/core/class/format.d.ts +0 -623
- package/types/core/class/html.d.ts +0 -430
- package/types/core/class/menu.d.ts +0 -126
- package/types/core/class/nodeTransform.d.ts +0 -93
- package/types/core/class/offset.d.ts +0 -522
- package/types/core/class/selection.d.ts +0 -188
- package/types/core/class/shortcuts.d.ts +0 -142
- package/types/core/class/toolbar.d.ts +0 -189
- package/types/core/class/ui.d.ts +0 -164
- package/types/core/class/viewer.d.ts +0 -140
- package/types/core/section/actives.d.ts +0 -46
- package/types/core/section/context.d.ts +0 -45
- package/types/editorInjector/_classes.d.ts +0 -41
- package/types/editorInjector/_core.d.ts +0 -87
- package/types/editorInjector/index.d.ts +0 -69
- package/types/modules/ApiManager.d.ts +0 -125
- package/types/modules/Browser.d.ts +0 -326
- package/types/modules/ColorPicker.d.ts +0 -135
- package/types/modules/Controller.d.ts +0 -251
- package/types/modules/Figure.d.ts +0 -517
- package/types/modules/FileManager.d.ts +0 -202
- package/types/modules/Modal.d.ts +0 -111
- package/types/modules/ModalAnchorEditor.d.ts +0 -236
- package/types/modules/SelectMenu.d.ts +0 -194
- package/types/modules/index.d.ts +0 -26
- package/types/plugins/dropdown/formatBlock.d.ts +0 -55
- package/types/plugins/dropdown/table.d.ts +0 -627
- package/types/plugins/modal/image.d.ts +0 -451
- /package/{LICENSE → LICENSE.txt} +0 -0
package/src/langs/ur.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
throw new Error('SUNEDITOR_LANG a window with a document');
|
|
10
10
|
}
|
|
11
11
|
return factory(w);
|
|
12
|
-
|
|
12
|
+
};
|
|
13
13
|
} else {
|
|
14
14
|
factory(global);
|
|
15
15
|
}
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
video_modal_url: 'ذرائع ابلاغ کا یو آر ایل، یوٹیوب/ویمیو',
|
|
207
207
|
width: 'چوڑائی',
|
|
208
208
|
message_copy_success: 'کلپ بورڈ میں کاپی ہو گیا',
|
|
209
|
-
message_copy_fail: 'کاپی ناکام۔ براہ کرم دستی طور پر کاپی کریں۔'
|
|
209
|
+
message_copy_fail: 'کاپی ناکام۔ براہ کرم دستی طور پر کاپی کریں۔',
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
if (typeof noGlobal === typeof undefined) {
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
enumerable: true,
|
|
216
216
|
writable: false,
|
|
217
217
|
configurable: false,
|
|
218
|
-
value: {}
|
|
218
|
+
value: {},
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
enumerable: true,
|
|
224
224
|
writable: true,
|
|
225
225
|
configurable: true,
|
|
226
|
-
value: lang
|
|
226
|
+
value: lang,
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
|
package/src/langs/zh_cn.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
throw new Error('SUNEDITOR_LANG a window with a document');
|
|
10
10
|
}
|
|
11
11
|
return factory(w);
|
|
12
|
-
|
|
12
|
+
};
|
|
13
13
|
} else {
|
|
14
14
|
factory(global);
|
|
15
15
|
}
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
video_modal_url: '嵌入网址, Youtube,Vimeo',
|
|
207
207
|
width: '宽度',
|
|
208
208
|
message_copy_success: '已复制到剪贴板',
|
|
209
|
-
message_copy_fail: '复制失败,请手动复制。'
|
|
209
|
+
message_copy_fail: '复制失败,请手动复制。',
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
if (typeof noGlobal === typeof undefined) {
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
enumerable: true,
|
|
216
216
|
writable: false,
|
|
217
217
|
configurable: false,
|
|
218
|
-
value: {}
|
|
218
|
+
value: {},
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
enumerable: true,
|
|
224
224
|
writable: true,
|
|
225
225
|
configurable: true,
|
|
226
|
-
value: lang
|
|
226
|
+
value: lang,
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -1,61 +1,71 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import ApiManager from '
|
|
1
|
+
import { dom, keyCodeMap } from '../../helper';
|
|
2
|
+
import { _w } from '../../helper/env';
|
|
3
|
+
import ApiManager from '../manager/ApiManager';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
+
* Browser file item structure
|
|
6
7
|
* @typedef {Object} BrowserFile
|
|
7
8
|
* @property {string} [src=""] - Source url
|
|
8
9
|
* @property {string} [name=""] - File name | Folder name
|
|
9
|
-
* @property {string
|
|
10
|
-
* @property {string
|
|
11
|
-
* @property {Array<string>|string
|
|
12
|
-
* @property {string
|
|
13
|
-
* @property {string
|
|
14
|
-
* @property {
|
|
15
|
-
* @property {
|
|
16
|
-
* @property {
|
|
10
|
+
* @property {string} [thumbnail] - Thumbnail url
|
|
11
|
+
* @property {string} [alt] - Image alt
|
|
12
|
+
* @property {Array<string>|string} [tag] - Tag name list
|
|
13
|
+
* @property {string} [type] - Type (image, video, audio, etc.)
|
|
14
|
+
* @property {string} [frame] - Frame name (iframe, video, etc.)
|
|
15
|
+
* @property {boolean} [default] - Whether this folder is the default selection.
|
|
16
|
+
* @property {Object<string, *>} [meta] - Metadata
|
|
17
|
+
* @property {BrowserFile | string} [_data] - Internal: The folder's contents or an API URL (⚠️ DO NOT USE directly)
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* @typedef BrowserParams
|
|
21
22
|
* @property {string} title - File browser window title. Required. Can be overridden in browser.
|
|
22
|
-
* @property {string
|
|
23
|
-
* @property {Object<string, *>|Array
|
|
24
|
-
* @property {string
|
|
25
|
-
* @property {Object<string, string
|
|
23
|
+
* @property {string} [className] - Class name of the file browser. Optional. Default: ''.
|
|
24
|
+
* @property {Object<string, *>|Array<*>} [data] - direct data without server calls
|
|
25
|
+
* @property {string} [url] - File server url. Required. Can be overridden in browser.
|
|
26
|
+
* @property {Object<string, string>} [headers] - File server http header. Required. Can be overridden in browser.
|
|
26
27
|
* @property {(target: Node) => void} selectorHandler - Function that actions when an item is clicked. Required. Can be overridden in browser.
|
|
27
|
-
* @property {boolean
|
|
28
|
-
* @property {string
|
|
29
|
-
* @property {Object<string, string
|
|
30
|
-
* @property {string
|
|
31
|
-
* @property {(item: BrowserFile) => string
|
|
32
|
-
* @property {Array
|
|
33
|
-
* @property {number
|
|
34
|
-
* @property {((item: BrowserFile) => string)
|
|
28
|
+
* @property {boolean} [useSearch] - Whether to use the search function. Optional. Default: `true`.
|
|
29
|
+
* @property {string} [searchUrl] - File server search url. Optional. Can be overridden in browser.
|
|
30
|
+
* @property {Object<string, string>} [searchUrlHeader] - File server search http header. Optional. Can be overridden in browser.
|
|
31
|
+
* @property {string} [listClass] - Class name of list div. Required. Can be overridden in browser.
|
|
32
|
+
* @property {(item: BrowserFile) => string} [drawItemHandler] - Function that defines the HTML of a file item. Required. Can be overridden in browser.
|
|
33
|
+
* @property {Array<*>} [props] - `props` argument to `drawItemHandler` function. Optional. Can be overridden in browser.
|
|
34
|
+
* @property {number} [columnSize] - Number of `div.se-file-item-column` to be created. Optional. Can be overridden in browser. Default: 4.
|
|
35
|
+
* @property {((item: BrowserFile) => string)} [thumbnail] - Default thumbnail
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* @class
|
|
39
40
|
* @description File browser plugin
|
|
40
41
|
*/
|
|
41
|
-
class Browser
|
|
42
|
+
class Browser {
|
|
43
|
+
#$;
|
|
44
|
+
|
|
45
|
+
#loading;
|
|
46
|
+
#globalEventHandler;
|
|
47
|
+
|
|
48
|
+
#closeSignal = false;
|
|
49
|
+
#bindClose = null;
|
|
50
|
+
|
|
42
51
|
/**
|
|
43
52
|
* @constructor
|
|
44
|
-
* @param {*}
|
|
53
|
+
* @param {*} host The instance object that called the constructor.
|
|
54
|
+
* @param {SunEditor.Deps} $ Kernel dependencies
|
|
45
55
|
* @param {BrowserParams} params Browser options
|
|
46
56
|
*/
|
|
47
|
-
constructor(
|
|
48
|
-
|
|
57
|
+
constructor(host, $, params) {
|
|
58
|
+
this.#$ = $;
|
|
49
59
|
|
|
50
60
|
// create HTML
|
|
51
61
|
this.useSearch = params.useSearch ?? true;
|
|
52
62
|
const browserFrame = dom.utils.createElement('DIV', { class: 'se-browser sun-editor-common' + (params.className ? ` ${params.className}` : '') });
|
|
53
|
-
const contentHTML = CreateHTMLInfos(
|
|
63
|
+
const contentHTML = CreateHTMLInfos(this.#$, this.useSearch);
|
|
54
64
|
const content = contentHTML.html;
|
|
55
65
|
|
|
56
66
|
// members
|
|
57
|
-
this.kind =
|
|
58
|
-
this.
|
|
67
|
+
this.kind = host.constructor['key'] || host.constructor.name;
|
|
68
|
+
this.host = host;
|
|
59
69
|
this.area = browserFrame;
|
|
60
70
|
this.header = contentHTML.header;
|
|
61
71
|
this.titleArea = contentHTML.titleArea;
|
|
@@ -64,7 +74,7 @@ class Browser extends CoreInjector {
|
|
|
64
74
|
this.list = contentHTML.list;
|
|
65
75
|
this.side = contentHTML.side;
|
|
66
76
|
this.wrapper = contentHTML.wrapper;
|
|
67
|
-
this
|
|
77
|
+
this.#loading = contentHTML._loading;
|
|
68
78
|
|
|
69
79
|
this.title = params.title;
|
|
70
80
|
this.listClass = params.listClass || 'se-preview-list';
|
|
@@ -77,66 +87,57 @@ class Browser extends CoreInjector {
|
|
|
77
87
|
this.selectorHandler = params.selectorHandler;
|
|
78
88
|
this.columnSize = params.columnSize || 4;
|
|
79
89
|
this.folderDefaultPath = '';
|
|
80
|
-
this.closeArrow = this
|
|
81
|
-
this.openArrow = this
|
|
82
|
-
this.icon_folder = this
|
|
83
|
-
this.icon_folder_item = this
|
|
84
|
-
this.icon_item = this
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @type {Array<BrowserFile>}
|
|
88
|
-
*/
|
|
90
|
+
this.closeArrow = this.#$.icons.menu_arrow_right;
|
|
91
|
+
this.openArrow = this.#$.icons.menu_arrow_down;
|
|
92
|
+
this.icon_folder = this.#$.icons.side_menu_folder_item;
|
|
93
|
+
this.icon_folder_item = this.#$.icons.side_menu_folder;
|
|
94
|
+
this.icon_item = this.#$.icons.side_menu_item;
|
|
95
|
+
|
|
96
|
+
/** @type {Array<BrowserFile>} */
|
|
89
97
|
this.items = [];
|
|
90
|
-
/**
|
|
91
|
-
* @type {Object<string, {name: string, meta: Object<string, *>}>}
|
|
92
|
-
*/
|
|
98
|
+
/** @type {Object<string, {name: string, meta: Object<string, *>}>} */
|
|
93
99
|
this.folders = {};
|
|
94
|
-
/**
|
|
95
|
-
* @type {Object<string, {key?: string, name?: string, children?: *}>}
|
|
96
|
-
*/
|
|
100
|
+
/** @type {Object<string, {key?: string, name?: string, children?: *}>} */
|
|
97
101
|
this.tree = {};
|
|
98
|
-
/**
|
|
99
|
-
* @type {BrowserFile}
|
|
100
|
-
*/
|
|
102
|
+
/** @type {BrowserFile} */
|
|
101
103
|
this.data = {};
|
|
102
104
|
this.selectedTags = [];
|
|
103
105
|
this.keyword = '';
|
|
104
106
|
this.sideInner = null;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.
|
|
107
|
+
|
|
108
|
+
// api manager
|
|
109
|
+
this.apiManager = new ApiManager(this, $, { method: 'GET' });
|
|
110
|
+
|
|
111
|
+
this.#globalEventHandler = (e) => {
|
|
108
112
|
if (!keyCodeMap.isEsc(e.code)) return;
|
|
109
113
|
this.close();
|
|
110
114
|
};
|
|
111
|
-
// api manager
|
|
112
|
-
this.apiManager = new ApiManager(this, { method: 'GET' });
|
|
113
115
|
|
|
114
116
|
// init
|
|
115
117
|
browserFrame.appendChild(dom.utils.createElement('DIV', { class: 'se-browser-back' }));
|
|
116
118
|
browserFrame.appendChild(content);
|
|
117
|
-
this.carrierWrapper.appendChild(browserFrame);
|
|
118
|
-
|
|
119
|
-
this
|
|
120
|
-
this
|
|
121
|
-
this
|
|
122
|
-
this
|
|
123
|
-
this
|
|
124
|
-
this
|
|
125
|
-
this
|
|
126
|
-
this
|
|
119
|
+
this.#$.contextProvider.carrierWrapper.appendChild(browserFrame);
|
|
120
|
+
|
|
121
|
+
this.#$.eventManager.addEvent(this.tagArea, 'click', this.#OnClickTag.bind(this));
|
|
122
|
+
this.#$.eventManager.addEvent(this.list, 'click', this.#OnClickFile.bind(this));
|
|
123
|
+
this.#$.eventManager.addEvent(this.side, 'click', this.#OnClickSide.bind(this));
|
|
124
|
+
this.#$.eventManager.addEvent(content, 'mousedown', this.#OnMouseDown_browser.bind(this));
|
|
125
|
+
this.#$.eventManager.addEvent(content, 'click', this.#OnClick_browser.bind(this));
|
|
126
|
+
this.#$.eventManager.addEvent(browserFrame.querySelector('form.se-browser-search-form'), 'submit', this.#Search.bind(this));
|
|
127
|
+
this.#$.eventManager.addEvent((this.sideOpenBtn = /** @type {HTMLButtonElement} */ (browserFrame.querySelector('.se-side-open-btn'))), 'click', this.#SideOpen.bind(this));
|
|
128
|
+
this.#$.eventManager.addEvent([this.header, browserFrame.querySelector('.se-browser-main')], 'mousedown', this.#SideClose.bind(this));
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
/**
|
|
130
132
|
* @description Open a file browser plugin
|
|
131
133
|
* @param {Object} [params={}]
|
|
132
|
-
* @param {string
|
|
133
|
-
* @param {string
|
|
134
|
-
* @param {string
|
|
135
|
-
* @param {Object<string, string
|
|
134
|
+
* @param {string} [params.listClass] - Class name of list div. If not, use `this.listClass`.
|
|
135
|
+
* @param {string} [params.title] - File browser window title. If not, use `this.title`.
|
|
136
|
+
* @param {string} [params.url] - File server url. If not, use `this.url`.
|
|
137
|
+
* @param {Object<string, string>} [params.urlHeader] - File server http header. If not, use `this.urlHeader`.
|
|
136
138
|
*/
|
|
137
|
-
open(params) {
|
|
138
|
-
|
|
139
|
-
this.__addGlobalEvent();
|
|
139
|
+
open(params = {}) {
|
|
140
|
+
this.#addGlobalEvent();
|
|
140
141
|
|
|
141
142
|
const listClassName = params.listClass || this.listClass;
|
|
142
143
|
if (!dom.utils.hasClass(this.list, listClassName)) {
|
|
@@ -145,22 +146,24 @@ class Browser extends CoreInjector {
|
|
|
145
146
|
|
|
146
147
|
this.titleArea.textContent = params.title || this.title;
|
|
147
148
|
this.area.style.display = 'block';
|
|
148
|
-
this.
|
|
149
|
-
this.closeArrow = this
|
|
149
|
+
this.#$.ui.opendBrowser = this;
|
|
150
|
+
this.closeArrow = this.#$.options.get('_rtl') ? this.#$.icons.menu_arrow_left : this.#$.icons.menu_arrow_right;
|
|
150
151
|
|
|
151
152
|
if (this.directData) {
|
|
152
|
-
this
|
|
153
|
+
this.#drowItems(this.directData);
|
|
153
154
|
} else {
|
|
154
|
-
this
|
|
155
|
+
this.#drawFileList(params.url || this.url, params.urlHeader || this.urlHeader, false);
|
|
155
156
|
}
|
|
157
|
+
|
|
158
|
+
this.body.style.maxHeight = dom.utils.getClientSize().h - (this.#$.offset.getGlobal(this.body).top - _w.scrollY) - 20 + 'px';
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
/**
|
|
159
162
|
* @description Close a browser plugin
|
|
160
|
-
* - The plugin's
|
|
163
|
+
* - The plugin's `init` method is called.
|
|
161
164
|
*/
|
|
162
165
|
close() {
|
|
163
|
-
this
|
|
166
|
+
this.#removeGlobalEvent();
|
|
164
167
|
this.apiManager.cancel();
|
|
165
168
|
|
|
166
169
|
this.area.style.display = 'none';
|
|
@@ -171,10 +174,10 @@ class Browser extends CoreInjector {
|
|
|
171
174
|
this.data = {};
|
|
172
175
|
this.keyword = '';
|
|
173
176
|
this.list.innerHTML = this.tagArea.innerHTML = this.titleArea.textContent = '';
|
|
174
|
-
this.
|
|
177
|
+
this.#$.ui.opendBrowser = null;
|
|
175
178
|
this.sideInner = null;
|
|
176
179
|
|
|
177
|
-
|
|
180
|
+
this.host.browserInit?.();
|
|
178
181
|
}
|
|
179
182
|
|
|
180
183
|
/**
|
|
@@ -184,10 +187,10 @@ class Browser extends CoreInjector {
|
|
|
184
187
|
search(keyword) {
|
|
185
188
|
if (this.searchUrl) {
|
|
186
189
|
this.keyword = keyword;
|
|
187
|
-
this
|
|
190
|
+
this.#drawFileList(this.searchUrl + '?keyword=' + keyword, this.searchUrlHeader, false);
|
|
188
191
|
} else {
|
|
189
192
|
this.keyword = keyword.toLowerCase();
|
|
190
|
-
this
|
|
193
|
+
this.#drawListItem(this.items, false);
|
|
191
194
|
}
|
|
192
195
|
}
|
|
193
196
|
|
|
@@ -205,24 +208,23 @@ class Browser extends CoreInjector {
|
|
|
205
208
|
* @description Show file browser loading box
|
|
206
209
|
*/
|
|
207
210
|
showBrowserLoading() {
|
|
208
|
-
this.
|
|
211
|
+
this.#loading.style.display = 'block';
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
/**
|
|
212
215
|
* @description Close file browser loading box
|
|
213
216
|
*/
|
|
214
217
|
closeBrowserLoading() {
|
|
215
|
-
this.
|
|
218
|
+
this.#loading.style.display = 'none';
|
|
216
219
|
}
|
|
217
220
|
|
|
218
221
|
/**
|
|
219
|
-
* @private
|
|
220
222
|
* @description Fetches the file list from the server.
|
|
221
223
|
* @param {string} url - The file server URL.
|
|
222
224
|
* @param {Object<string, string>} urlHeader - The HTTP headers for the request.
|
|
223
225
|
* @param {boolean} pageLoading - Indicates if this is a paginated request.
|
|
224
226
|
*/
|
|
225
|
-
|
|
227
|
+
#drawFileList(url, urlHeader, pageLoading) {
|
|
226
228
|
this.apiManager.call({ method: 'GET', url, headers: urlHeader, callBack: this.#CallBackGet.bind(this), errorCallBack: this.#CallBackError.bind(this) });
|
|
227
229
|
if (!pageLoading) {
|
|
228
230
|
this.sideOpenBtn.style.display = 'none';
|
|
@@ -231,12 +233,11 @@ class Browser extends CoreInjector {
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
/**
|
|
234
|
-
* @private
|
|
235
236
|
* @description Updates the displayed list of file items.
|
|
236
237
|
* @param {Array<BrowserFile>} items - The file items to display.
|
|
237
238
|
* @param {boolean} update - Whether to update the tags.
|
|
238
239
|
*/
|
|
239
|
-
|
|
240
|
+
#drawListItem(items, update) {
|
|
240
241
|
const keyword = this.keyword;
|
|
241
242
|
items = this.tagfilter(items).filter((item) => item.name.toLowerCase().indexOf(keyword) > -1);
|
|
242
243
|
|
|
@@ -281,41 +282,38 @@ class Browser extends CoreInjector {
|
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
/**
|
|
284
|
-
* @private
|
|
285
285
|
* @description Adds a global event listener for closing the browser.
|
|
286
286
|
*/
|
|
287
|
-
|
|
288
|
-
this
|
|
289
|
-
this
|
|
287
|
+
#addGlobalEvent() {
|
|
288
|
+
this.#removeGlobalEvent();
|
|
289
|
+
this.#bindClose = this.#$.eventManager.addGlobalEvent('keydown', this.#globalEventHandler, true);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
* @private
|
|
294
293
|
* @description Removes the global event listener for closing the browser.
|
|
295
294
|
*/
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
#removeGlobalEvent() {
|
|
296
|
+
this.#bindClose &&= this.#$.eventManager.removeGlobalEvent(this.#bindClose);
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
/**
|
|
301
|
-
* @private
|
|
302
300
|
* @description Renders the file items or folder structure from data.
|
|
303
301
|
* @param {BrowserFile[]|BrowserFile} data - The data representing the file structure.
|
|
304
|
-
* @returns {boolean}
|
|
302
|
+
* @returns {boolean} `true` if rendering was successful, `false` otherwise.
|
|
305
303
|
*/
|
|
306
|
-
|
|
304
|
+
#drowItems(data) {
|
|
307
305
|
if (Array.isArray(data)) {
|
|
308
306
|
if (data.length > 0) {
|
|
309
|
-
this
|
|
307
|
+
this.#drawListItem(data, true);
|
|
310
308
|
}
|
|
311
309
|
return true;
|
|
312
310
|
} else if (typeof data === 'object') {
|
|
313
311
|
this.sideOpenBtn.style.display = '';
|
|
314
|
-
this
|
|
312
|
+
this.#parseFolderData(data);
|
|
315
313
|
|
|
316
314
|
this.side.innerHTML = '';
|
|
317
315
|
const sideInner = (this.sideInner = dom.utils.createElement('div', null));
|
|
318
|
-
this
|
|
316
|
+
this.#createFolderList(this.tree, sideInner);
|
|
319
317
|
this.side.appendChild(sideInner);
|
|
320
318
|
|
|
321
319
|
if (this.folderDefaultPath) {
|
|
@@ -333,12 +331,11 @@ class Browser extends CoreInjector {
|
|
|
333
331
|
}
|
|
334
332
|
|
|
335
333
|
/**
|
|
336
|
-
* @private
|
|
337
334
|
* @description Parses folder data into a structured format.
|
|
338
335
|
* @param {BrowserFile} data - The folder data.
|
|
339
336
|
* @param {string} [path] - The current path in the folder hierarchy.
|
|
340
337
|
*/
|
|
341
|
-
|
|
338
|
+
#parseFolderData(data, path) {
|
|
342
339
|
let current = this.tree;
|
|
343
340
|
|
|
344
341
|
// _data
|
|
@@ -351,9 +348,7 @@ class Browser extends CoreInjector {
|
|
|
351
348
|
const parts = path.split('/');
|
|
352
349
|
const len = parts.length - 1;
|
|
353
350
|
parts.forEach((part, index) => {
|
|
354
|
-
|
|
355
|
-
current[part] = { children: {} };
|
|
356
|
-
}
|
|
351
|
+
current[part] ||= { children: {} };
|
|
357
352
|
|
|
358
353
|
if (index === len) {
|
|
359
354
|
current[part].key = path;
|
|
@@ -375,20 +370,19 @@ class Browser extends CoreInjector {
|
|
|
375
370
|
|
|
376
371
|
this.folders[currentPath] = {
|
|
377
372
|
name: v.name || key,
|
|
378
|
-
meta: v.meta || {}
|
|
373
|
+
meta: v.meta || {},
|
|
379
374
|
};
|
|
380
375
|
|
|
381
|
-
this
|
|
376
|
+
this.#parseFolderData(v, currentPath);
|
|
382
377
|
});
|
|
383
378
|
}
|
|
384
379
|
|
|
385
380
|
/**
|
|
386
|
-
* @private
|
|
387
381
|
* @description Creates a nested folder list from parsed data.
|
|
388
382
|
* @param {BrowserFile[]|BrowserFile} folderData - The structured folder data.
|
|
389
383
|
* @param {HTMLElement} parentElement - The parent element to append folder structure to.
|
|
390
384
|
*/
|
|
391
|
-
|
|
385
|
+
#createFolderList(folderData, parentElement) {
|
|
392
386
|
for (const key in folderData) {
|
|
393
387
|
const item = folderData[key];
|
|
394
388
|
if (!item) continue;
|
|
@@ -397,14 +391,14 @@ class Browser extends CoreInjector {
|
|
|
397
391
|
const folderLabel = dom.utils.createElement(
|
|
398
392
|
'div',
|
|
399
393
|
item.key ? { 'data-command': item.key, 'aria-label': item.name } : null,
|
|
400
|
-
`<span class="se-menu-icon">${item.key ? this.icon_folder : this.icon_folder_item}</span><span>${item.name}</span
|
|
394
|
+
`<span class="se-menu-icon">${item.key ? this.icon_folder : this.icon_folder_item}</span><span>${item.name}</span>`,
|
|
401
395
|
);
|
|
402
396
|
const folderDiv = dom.utils.createElement('div', { class: 'se-menu-folder' }, folderLabel);
|
|
403
397
|
|
|
404
398
|
folderLabel.insertBefore(dom.utils.createElement('button', null, this.closeArrow), folderLabel.firstElementChild);
|
|
405
399
|
const childContainer = document.createElement('div');
|
|
406
400
|
dom.utils.addClass(childContainer, 'se-menu-child|se-menu-hidden');
|
|
407
|
-
this
|
|
401
|
+
this.#createFolderList(item.children, childContainer);
|
|
408
402
|
folderDiv.appendChild(childContainer);
|
|
409
403
|
|
|
410
404
|
parentElement.appendChild(folderDiv);
|
|
@@ -427,7 +421,7 @@ class Browser extends CoreInjector {
|
|
|
427
421
|
try {
|
|
428
422
|
const res = JSON.parse(xmlHttp.responseText);
|
|
429
423
|
const data = res.result;
|
|
430
|
-
if (this
|
|
424
|
+
if (this.#drowItems(data)) return;
|
|
431
425
|
|
|
432
426
|
if (res.nullMessage) {
|
|
433
427
|
this.list.innerHTML = res.nullMessage;
|
|
@@ -436,7 +430,6 @@ class Browser extends CoreInjector {
|
|
|
436
430
|
throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${e.message}"`);
|
|
437
431
|
} finally {
|
|
438
432
|
this.closeBrowserLoading();
|
|
439
|
-
this.body.style.maxHeight = dom.utils.getClientSize().h - this.header.offsetHeight - 50 + 'px';
|
|
440
433
|
}
|
|
441
434
|
}
|
|
442
435
|
|
|
@@ -468,7 +461,7 @@ class Browser extends CoreInjector {
|
|
|
468
461
|
dom.utils.addClass(selectTag, 'on');
|
|
469
462
|
}
|
|
470
463
|
|
|
471
|
-
this
|
|
464
|
+
this.#drawListItem(this.items, false);
|
|
472
465
|
}
|
|
473
466
|
|
|
474
467
|
/**
|
|
@@ -518,9 +511,9 @@ class Browser extends CoreInjector {
|
|
|
518
511
|
this.tagArea.innerHTML = '';
|
|
519
512
|
|
|
520
513
|
if (typeof data === 'string') {
|
|
521
|
-
this
|
|
514
|
+
this.#drawFileList(data, this.urlHeader, true);
|
|
522
515
|
} else {
|
|
523
|
-
this
|
|
516
|
+
this.#drawListItem(data, false);
|
|
524
517
|
}
|
|
525
518
|
}
|
|
526
519
|
|
|
@@ -530,9 +523,9 @@ class Browser extends CoreInjector {
|
|
|
530
523
|
#OnMouseDown_browser(e) {
|
|
531
524
|
const eventTarget = dom.query.getEventTarget(e);
|
|
532
525
|
if (/se-browser-inner/.test(eventTarget.className)) {
|
|
533
|
-
this
|
|
526
|
+
this.#closeSignal = true;
|
|
534
527
|
} else {
|
|
535
|
-
this
|
|
528
|
+
this.#closeSignal = false;
|
|
536
529
|
}
|
|
537
530
|
}
|
|
538
531
|
|
|
@@ -543,7 +536,7 @@ class Browser extends CoreInjector {
|
|
|
543
536
|
const eventTarget = dom.query.getEventTarget(e);
|
|
544
537
|
e.stopPropagation();
|
|
545
538
|
|
|
546
|
-
if (/close/.test(eventTarget.getAttribute('data-command')) || this
|
|
539
|
+
if (/close/.test(eventTarget.getAttribute('data-command')) || this.#closeSignal) {
|
|
547
540
|
this.close();
|
|
548
541
|
}
|
|
549
542
|
}
|
|
@@ -584,14 +577,13 @@ class Browser extends CoreInjector {
|
|
|
584
577
|
}
|
|
585
578
|
|
|
586
579
|
/**
|
|
587
|
-
* @
|
|
588
|
-
* @param {__se__EditorCore} editor - editor instance
|
|
580
|
+
* @param {SunEditor.Deps} $ - editor instance
|
|
589
581
|
* @param {boolean} useSearch - Whether to use the search function
|
|
590
582
|
* @returns {{ html: HTMLElement, header: HTMLElement, titleArea: HTMLElement, tagArea: HTMLElement, body: HTMLElement, list: HTMLElement, side: HTMLElement, wrapper: HTMLElement, _loading: HTMLElement }} HTML
|
|
591
583
|
*/
|
|
592
|
-
function CreateHTMLInfos(
|
|
593
|
-
const lang =
|
|
594
|
-
const icons =
|
|
584
|
+
function CreateHTMLInfos($, useSearch) {
|
|
585
|
+
const lang = $.lang;
|
|
586
|
+
const icons = $.icons;
|
|
595
587
|
const htmlString = /*html*/ `
|
|
596
588
|
<div class="se-browser-content">
|
|
597
589
|
<div class="se-browser-header">
|
|
@@ -638,15 +630,14 @@ function CreateHTMLInfos(editor, useSearch) {
|
|
|
638
630
|
list: content.querySelector('.se-browser-list'),
|
|
639
631
|
side: content.querySelector('.se-browser-side'),
|
|
640
632
|
wrapper: content.querySelector('.se-browser-wrapper'),
|
|
641
|
-
_loading: content.querySelector('.se-loading-box')
|
|
633
|
+
_loading: content.querySelector('.se-loading-box'),
|
|
642
634
|
};
|
|
643
635
|
}
|
|
644
636
|
|
|
645
637
|
/**
|
|
646
|
-
* @private
|
|
647
638
|
* @this {{ thumbnail: ((...args: *) => *), props: Array<*> }}
|
|
648
|
-
* @description Define the HTML of the item to be put in
|
|
649
|
-
* - Format: [ { src: "image src", name: "name(@option)", alt: "image alt(@option)", tag: "tag name(@option)" } ]
|
|
639
|
+
* @description Define the HTML of the item to be put in `div.se-file-item-column`.
|
|
640
|
+
* - Format: `[ { src: "image src", name: "name(@option)", alt: "image alt(@option)", tag: "tag name(@option)" } ]`
|
|
650
641
|
* @param {BrowserFile} item Item of the response data's array
|
|
651
642
|
*/
|
|
652
643
|
function DrawItems(item) {
|