@web-atoms/web-controls 2.6.4 → 2.6.6
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/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-esm/ArrayLike.js +14 -12
- package/dist-esm/DataAttributes.js +18 -19
- package/dist-esm/Focusable.js +10 -11
- package/dist-esm/ModuleFiles.js +43 -42
- package/dist-esm/NumberFormats.js +60 -56
- package/dist-esm/PageNavigator.js +28 -30
- package/dist-esm/animations/Animations.global.css +2 -0
- package/dist-esm/animations/Animations.global.css.map +1 -0
- package/dist-esm/animations/Animations.js +36 -33
- package/dist-esm/basic/AtomChips.js +312 -305
- package/dist-esm/basic/AtomRepeater.js +1070 -1035
- package/dist-esm/basic/AtomSuggestions.js +97 -107
- package/dist-esm/basic/AttachedPopup.js +0 -1
- package/dist-esm/basic/Button.js +45 -19
- package/dist-esm/basic/Button.local.css +2 -0
- package/dist-esm/basic/Button.local.css.map +1 -0
- package/dist-esm/basic/ButtonBar.global.css +2 -0
- package/dist-esm/basic/ButtonBar.global.css.map +1 -0
- package/dist-esm/basic/ButtonBar.js +84 -64
- package/dist-esm/basic/Calendar.js +211 -203
- package/dist-esm/basic/CheckBoxList.js +90 -70
- package/dist-esm/basic/Checkbox.js +16 -8
- package/dist-esm/basic/Chip.js +36 -12
- package/dist-esm/basic/ComboBox.js +47 -51
- package/dist-esm/basic/DataGrid.js +258 -252
- package/dist-esm/basic/DateField.js +149 -127
- package/dist-esm/basic/DropDown.js +91 -103
- package/dist-esm/basic/DropDownInput.global.css +2 -0
- package/dist-esm/basic/DropDownInput.global.css.map +1 -0
- package/dist-esm/basic/DropDownInput.js +78 -106
- package/dist-esm/basic/Editable.js +82 -77
- package/dist-esm/basic/Expander.js +104 -86
- package/dist-esm/basic/FilesDragDrop.global.css +2 -0
- package/dist-esm/basic/FilesDragDrop.global.css.map +1 -0
- package/dist-esm/basic/FilesDragDrop.js +84 -80
- package/dist-esm/basic/Form.js +80 -52
- package/dist-esm/basic/FormField.js +164 -106
- package/dist-esm/basic/IElement.js +1 -2
- package/dist-esm/basic/InlinePopup.js +263 -234
- package/dist-esm/basic/InlinePopupButton.js +99 -88
- package/dist-esm/basic/InlinePopupControl.js +24 -23
- package/dist-esm/basic/ItemPath.js +59 -60
- package/dist-esm/basic/LimitedText.js +49 -38
- package/dist-esm/basic/ListRepeater.js +13 -14
- package/dist-esm/basic/MaskedInput.js +37 -29
- package/dist-esm/basic/MaskedInputDiv.js +55 -48
- package/dist-esm/basic/MergeNode.js +64 -35
- package/dist-esm/basic/PasswordBox.js +32 -17
- package/dist-esm/basic/PinchZoomView.js +221 -199
- package/dist-esm/basic/PopupButton.js +39 -16
- package/dist-esm/basic/PopupMenu.js +3 -4
- package/dist-esm/basic/RadioButtonList.js +35 -25
- package/dist-esm/basic/RefreshLock.js +41 -42
- package/dist-esm/basic/Resizable.js +43 -33
- package/dist-esm/basic/Select.js +72 -65
- package/dist-esm/basic/SortByButton.global.css +2 -0
- package/dist-esm/basic/SortByButton.global.css.map +1 -0
- package/dist-esm/basic/SortByButton.js +41 -31
- package/dist-esm/basic/Swipe.js +91 -84
- package/dist-esm/basic/Switch.js +22 -8
- package/dist-esm/basic/TableRepeater.js +29 -33
- package/dist-esm/basic/TimeEditor.js +97 -52
- package/dist-esm/basic/TitleEditor.js +115 -95
- package/dist-esm/basic/ToggleButtonBar.js +21 -22
- package/dist-esm/basic/Tooltip.js +49 -47
- package/dist-esm/basic/TypeWriter.js +45 -42
- package/dist-esm/basic/UploadEvent.js +211 -178
- package/dist-esm/basic/ZoomView.js +229 -198
- package/dist-esm/basic/combineClasses.js +2 -3
- package/dist-esm/basic/elements/AtomPopover.css +2 -0
- package/dist-esm/basic/elements/AtomPopover.css.map +1 -0
- package/dist-esm/basic/elements/AtomPopover.js +270 -253
- package/dist-esm/basic/elements/getContainingBlock.js +34 -35
- package/dist-esm/basic/elements/relativeRect.js +40 -21
- package/dist-esm/basic/styles/calendar.global.css +2 -0
- package/dist-esm/basic/styles/calendar.global.css.map +1 -0
- package/dist-esm/basic/styles/check-box-list.global.css +2 -0
- package/dist-esm/basic/styles/check-box-list.global.css.map +1 -0
- package/dist-esm/basic/styles/checkbox.global.css +2 -0
- package/dist-esm/basic/styles/checkbox.global.css.map +1 -0
- package/dist-esm/basic/styles/chip.global.css +2 -0
- package/dist-esm/basic/styles/chip.global.css.map +1 -0
- package/dist-esm/basic/styles/chips.global.css +2 -0
- package/dist-esm/basic/styles/chips.global.css.map +1 -0
- package/dist-esm/basic/styles/data-grid.global.css +2 -0
- package/dist-esm/basic/styles/data-grid.global.css.map +1 -0
- package/dist-esm/basic/styles/date-field.global.css +2 -0
- package/dist-esm/basic/styles/date-field.global.css.map +1 -0
- package/dist-esm/basic/styles/drop-down.global.css +2 -0
- package/dist-esm/basic/styles/drop-down.global.css.map +1 -0
- package/dist-esm/basic/styles/expander.global.css +2 -0
- package/dist-esm/basic/styles/expander.global.css.map +1 -0
- package/dist-esm/basic/styles/form-field.global.css +2 -0
- package/dist-esm/basic/styles/form-field.global.css.map +1 -0
- package/dist-esm/basic/styles/inline-popup.global.css +2 -0
- package/dist-esm/basic/styles/inline-popup.global.css.map +1 -0
- package/dist-esm/basic/styles/item-suggestion.global.css +2 -0
- package/dist-esm/basic/styles/item-suggestion.global.css.map +1 -0
- package/dist-esm/basic/styles/list-repeater.global.css +2 -0
- package/dist-esm/basic/styles/list-repeater.global.css.map +1 -0
- package/dist-esm/basic/styles/masked-input.global.css +2 -0
- package/dist-esm/basic/styles/masked-input.global.css.map +1 -0
- package/dist-esm/basic/styles/password-box.global.css +2 -0
- package/dist-esm/basic/styles/password-box.global.css.map +1 -0
- package/dist-esm/basic/styles/pinch-zoom-view.global.css +2 -0
- package/dist-esm/basic/styles/pinch-zoom-view.global.css.map +1 -0
- package/dist-esm/basic/styles/popup-button.global.css +2 -0
- package/dist-esm/basic/styles/popup-button.global.css.map +1 -0
- package/dist-esm/basic/styles/popup.global.css +2 -0
- package/dist-esm/basic/styles/popup.global.css.map +1 -0
- package/dist-esm/basic/styles/radio-button-list.global.css +2 -0
- package/dist-esm/basic/styles/radio-button-list.global.css.map +1 -0
- package/dist-esm/basic/styles/repeater.global.css +2 -0
- package/dist-esm/basic/styles/repeater.global.css.map +1 -0
- package/dist-esm/basic/styles/scale.svg +4 -0
- package/dist-esm/basic/styles/suggestion-popup.global.css +2 -0
- package/dist-esm/basic/styles/suggestion-popup.global.css.map +1 -0
- package/dist-esm/basic/styles/suggestion.global.css +2 -0
- package/dist-esm/basic/styles/suggestion.global.css.map +1 -0
- package/dist-esm/basic/styles/swipe.global.css +2 -0
- package/dist-esm/basic/styles/swipe.global.css.map +1 -0
- package/dist-esm/basic/styles/switch.global.css +2 -0
- package/dist-esm/basic/styles/switch.global.css.map +1 -0
- package/dist-esm/basic/styles/time-editor.global.css +2 -0
- package/dist-esm/basic/styles/time-editor.global.css.map +1 -0
- package/dist-esm/basic/styles/title-editor.global.css +2 -0
- package/dist-esm/basic/styles/title-editor.global.css.map +1 -0
- package/dist-esm/basic/styles/toggle-button-bar.global.css +2 -0
- package/dist-esm/basic/styles/toggle-button-bar.global.css.map +1 -0
- package/dist-esm/basic/styles/toggle-view.global.css +2 -0
- package/dist-esm/basic/styles/toggle-view.global.css.map +1 -0
- package/dist-esm/basic/styles/tooltip.global.css +2 -0
- package/dist-esm/basic/styles/tooltip.global.css.map +1 -0
- package/dist-esm/basic/styles/zoom-view.global.css +2 -0
- package/dist-esm/basic/styles/zoom-view.global.css.map +1 -0
- package/dist-esm/desktop-app/DesktopApp.js +65 -80
- package/dist-esm/desktop-app/MobileDesktopApp.js +20 -23
- package/dist-esm/html-editor/AtomHtmlEditor.js +243 -268
- package/dist-esm/html-editor/HtmlEditorCommands.js +6 -4
- package/dist-esm/html-editor/InlineHtmlEditor.js +174 -166
- package/dist-esm/html-editor/RangeEditor.js +49 -51
- package/dist-esm/html-editor/commands/AddImage.js +40 -35
- package/dist-esm/html-editor/commands/AddLink.js +56 -54
- package/dist-esm/html-editor/commands/AddLink.local.css +2 -0
- package/dist-esm/html-editor/commands/AddLink.local.css.map +1 -0
- package/dist-esm/html-editor/commands/Align.js +24 -7
- package/dist-esm/html-editor/commands/AttachFile.js +23 -13
- package/dist-esm/html-editor/commands/AttachImage.js +35 -25
- package/dist-esm/html-editor/commands/Bold.js +10 -11
- package/dist-esm/html-editor/commands/ChangeColor.js +31 -107
- package/dist-esm/html-editor/commands/ChangeColor.local.css +2 -0
- package/dist-esm/html-editor/commands/ChangeColor.local.css.map +1 -0
- package/dist-esm/html-editor/commands/ChangeFont.js +42 -42
- package/dist-esm/html-editor/commands/ChangeFont.local.css +2 -0
- package/dist-esm/html-editor/commands/ChangeFont.local.css.map +1 -0
- package/dist-esm/html-editor/commands/ChangeFontSize.js +15 -5
- package/dist-esm/html-editor/commands/Command.js +34 -16
- package/dist-esm/html-editor/commands/CommandButton.js +51 -32
- package/dist-esm/html-editor/commands/Headings.js +25 -9
- package/dist-esm/html-editor/commands/HorizontalRule.js +9 -10
- package/dist-esm/html-editor/commands/HtmlCommands.js +160 -65
- package/dist-esm/html-editor/commands/IndentLess.js +10 -11
- package/dist-esm/html-editor/commands/IndentMore.js +10 -11
- package/dist-esm/html-editor/commands/Italic.js +10 -11
- package/dist-esm/html-editor/commands/NumberedList.js +10 -11
- package/dist-esm/html-editor/commands/Quote.js +10 -11
- package/dist-esm/html-editor/commands/RemoveFormat.js +10 -11
- package/dist-esm/html-editor/commands/Separator.global.css +2 -0
- package/dist-esm/html-editor/commands/Separator.global.css.map +1 -0
- package/dist-esm/html-editor/commands/Separator.js +5 -4
- package/dist-esm/html-editor/commands/Source.js +29 -25
- package/dist-esm/html-editor/commands/Source.local.css +2 -0
- package/dist-esm/html-editor/commands/Source.local.css.map +1 -0
- package/dist-esm/html-editor/commands/StrikeThrough.js +10 -11
- package/dist-esm/html-editor/commands/Toolbar.js +6 -4
- package/dist-esm/html-editor/commands/Underline.js +10 -11
- package/dist-esm/html-editor/commands/Unlink.js +10 -9
- package/dist-esm/html-editor/commands/UnorderedList.js +10 -11
- package/dist-esm/mobile-app/BottomPopup.js +137 -148
- package/dist-esm/mobile-app/MasterDetailPage.global.css +2 -0
- package/dist-esm/mobile-app/MasterDetailPage.global.css.map +1 -0
- package/dist-esm/mobile-app/MasterDetailPage.js +153 -152
- package/dist-esm/mobile-app/MobileApp.global.css +2 -0
- package/dist-esm/mobile-app/MobileApp.global.css.map +1 -0
- package/dist-esm/mobile-app/MobileApp.js +577 -569
- package/dist-esm/mobile-app/bottom-popup.global.css +2 -0
- package/dist-esm/mobile-app/bottom-popup.global.css.map +1 -0
- package/dist-esm/player/AtomVideoPlayer.global.css +2 -0
- package/dist-esm/player/AtomVideoPlayer.global.css.map +1 -0
- package/dist-esm/player/AtomVideoPlayer.js +316 -270
- package/dist-esm/player/TrackProgress.js +11 -7
- package/dist-esm/player/input-range-style.js +97 -98
- package/dist-esm/styles/atom-html-editor.global.css +2 -0
- package/dist-esm/styles/atom-html-editor.global.css.map +1 -0
- package/dist-esm/styles/button-bar.global.css +2 -0
- package/dist-esm/styles/button-bar.global.css.map +1 -0
- package/dist-esm/styles/desktop-app.global.css +2 -0
- package/dist-esm/styles/desktop-app.global.css.map +1 -0
- package/dist-esm/styles/form.global.css +2 -0
- package/dist-esm/styles/form.global.css.map +1 -0
- package/dist-esm/styles/html-editor-toolbar.global.css +2 -0
- package/dist-esm/styles/html-editor-toolbar.global.css.map +1 -0
- package/dist-esm/styles/inline-html-editor.global.css +2 -0
- package/dist-esm/styles/inline-html-editor.global.css.map +1 -0
- package/dist-esm/styles/limited-text.global.css +2 -0
- package/dist-esm/styles/limited-text.global.css.map +1 -0
- package/dist-esm/styles/resizable.global.css +2 -0
- package/dist-esm/styles/resizable.global.css.map +1 -0
- package/dist-esm/styles/track-progress.global.css +2 -0
- package/dist-esm/styles/track-progress.global.css.map +1 -0
- package/dist-esm/styles/type-writer.global.css +2 -0
- package/dist-esm/styles/type-writer.global.css.map +1 -0
- package/dist-esm/tests/app-test/AppTestApp.js +12 -15
- package/dist-esm/tests/app-test/AppTestApp.pack.js +54 -0
- package/dist-esm/tests/app-test/commands/AppCommands.js +14 -11
- package/dist-esm/tests/app-test/drawer/AppDrawer.js +4 -6
- package/dist-esm/tests/app-test/model/model.js +1 -2
- package/dist-esm/tests/app-test/pages/detail/DetailPage.js +21 -15
- package/dist-esm/tests/app-test/pages/home/HomePage.js +7 -8
- package/dist-esm/tests/app-test/pages/list/ListPage.js +79 -62
- package/dist-esm/tests/app-test/pages/list/ListPage.local.css +2 -0
- package/dist-esm/tests/app-test/pages/list/ListPage.local.css.map +1 -0
- package/dist-esm/tests/basic/PopupTest.js +9 -7
- package/dist-esm/tests/basic/TimeEditorTest.js +5 -9
- package/dist-esm/tests/basic/TimeEditorTest.pack.js +39 -0
- package/dist-esm/tests/basic/TimerTest.js +27 -37
- package/dist-esm/tests/basic/TimerTest.pack.js +40 -0
- package/dist-esm/tests/basic/basic-form/BasicForm.js +47 -27
- package/dist-esm/tests/basic/basic-form/BasicForm.pack.js +44 -0
- package/dist-esm/tests/basic/calendar/BasicCalendarTest.js +5 -9
- package/dist-esm/tests/basic/calendar/BasicCalendarTest.pack.js +53 -0
- package/dist-esm/tests/basic/chips/ChipsTest.js +25 -15
- package/dist-esm/tests/basic/chips/ChipsTest.local.css +2 -0
- package/dist-esm/tests/basic/chips/ChipsTest.local.css.map +1 -0
- package/dist-esm/tests/basic/chips/ChipsTest.pack.js +56 -0
- package/dist-esm/tests/basic/data-grid/DataGridTest.js +55 -60
- package/dist-esm/tests/basic/data-grid/DataGridTest.pack.js +58 -0
- package/dist-esm/tests/basic/date/DateFieldTest.js +21 -96
- package/dist-esm/tests/basic/date/DateFieldTest.pack.js +57 -0
- package/dist-esm/tests/basic/drop-down/DropDownTest.js +25 -19
- package/dist-esm/tests/basic/drop-down/DropDownTest.pack.js +52 -0
- package/dist-esm/tests/basic/drop-down-input/DropDownTest.js +32 -32
- package/dist-esm/tests/basic/drop-down-input/DropDownTest.pack.js +54 -0
- package/dist-esm/tests/basic/expander/ExpanderMenuTest.js +20 -14
- package/dist-esm/tests/basic/expander/ExpanderMenuTest.pack.js +38 -0
- package/dist-esm/tests/basic/expander/ExpanderTest.js +11 -12
- package/dist-esm/tests/basic/expander/ExpanderTest.pack.js +38 -0
- package/dist-esm/tests/basic/form2/Form2Test.js +26 -24
- package/dist-esm/tests/basic/form2/Form2Test.pack.js +46 -0
- package/dist-esm/tests/basic/limited-text/LimitedTextTest.js +14 -11
- package/dist-esm/tests/basic/limited-text/LimitedTextTest.pack.js +38 -0
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.global.css +2 -0
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.global.css.map +1 -0
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.js +14 -14
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.pack.js +38 -0
- package/dist-esm/tests/basic/repeater/DragDropRepater.js +30 -12
- package/dist-esm/tests/basic/repeater/DragDropRepater.pack.js +51 -0
- package/dist-esm/tests/basic/repeater/RepeaterTest.js +45 -35
- package/dist-esm/tests/basic/repeater/RepeaterTest.pack.js +52 -0
- package/dist-esm/tests/basic/swipe/SwipeTest.js +13 -13
- package/dist-esm/tests/basic/swipe/SwipeTest.local.css +2 -0
- package/dist-esm/tests/basic/swipe/SwipeTest.local.css.map +1 -0
- package/dist-esm/tests/basic/swipe/SwipeTest.pack.js +52 -0
- package/dist-esm/tests/basic/switch-test/SwitchTest.js +8 -10
- package/dist-esm/tests/basic/switch-test/SwitchTest.pack.js +38 -0
- package/dist-esm/tests/basic/title-editor/TitleEditorTest.js +8 -9
- package/dist-esm/tests/basic/title-editor/TitleEditorTest.pack.js +38 -0
- package/dist-esm/tests/basic/tooltip/TooltipTest.js +30 -24
- package/dist-esm/tests/basic/tooltip/TooltipTest.pack.js +52 -0
- package/dist-esm/tests/basic/typewriter/TypeWriter.js +10 -9
- package/dist-esm/tests/basic/typewriter/TypeWriter.pack.js +39 -0
- package/dist-esm/tests/basic/video/AtomVideoTest.js +13 -10
- package/dist-esm/tests/basic/video/AtomVideoTest.local.css +2 -0
- package/dist-esm/tests/basic/video/AtomVideoTest.local.css.map +1 -0
- package/dist-esm/tests/basic/video/AtomVideoTest.pack.js +38 -0
- package/dist-esm/tests/basic/zoom/ZoomViewTest.js +13 -13
- package/dist-esm/tests/basic/zoom/ZoomViewTest.local.css +2 -0
- package/dist-esm/tests/basic/zoom/ZoomViewTest.local.css.map +1 -0
- package/dist-esm/tests/basic/zoom/ZoomViewTest.pack.js +38 -0
- package/dist-esm/tests/check-box-list/CheckBoxListSample.js +13 -12
- package/dist-esm/tests/check-box-list/CheckBoxListSample.pack.js +52 -0
- package/dist-esm/tests/data-grid/GridTestViewModel.js +203 -227
- package/dist-esm/tests/form/CustomHelp.js +6 -9
- package/dist-esm/tests/form/FormViewModel.js +21 -28
- package/dist-esm/tests/html-editor/HtmlEditorTest.js +7 -37
- package/dist-esm/tests/html-editor/HtmlEditorTest.pack.js +83 -0
- package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.js +9 -38
- package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.pack.js +85 -0
- package/dist-esm/tests/mask/MaskedInputTest.js +11 -12
- package/dist-esm/tests/mask/MaskedInputTest.pack.js +38 -0
- package/dist-esm/tests/mobile-app/DesktopAppTest.js +8 -9
- package/dist-esm/tests/mobile-app/DesktopAppTest.pack.js +60 -0
- package/dist-esm/tests/mobile-app/MobileAppTest.js +64 -53
- package/dist-esm/tests/mobile-app/MobileAppTest.pack.js +55 -0
- package/dist-esm/tests/pop-over/PopOverTest.js +37 -77
- package/dist-esm/tests/switch/SwitchTest.js +9 -8
- package/dist-esm/tests/toggle-view/ToggleView.local.css +2 -0
- package/dist-esm/tests/toggle-view/ToggleView.local.css.map +1 -0
- package/dist-esm/tests/toggle-view/ToggleViewTest.js +15 -22
- package/dist-esm/tests/toggle-view/ToggleViewTest.pack.js +45 -0
- package/dist-esm/toggle-view/AtomToggleView.js +77 -73
- package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -5,173 +5,181 @@ import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl.js";
|
|
|
5
5
|
import { ChildEnumerator, descendentElementIterator } from "@web-atoms/core/dist/web/core/AtomUI.js";
|
|
6
6
|
import "@web-atoms/data-styles/data-styles";
|
|
7
7
|
import { showImageDialog } from "./commands/AddImage.js";
|
|
8
|
-
import
|
|
8
|
+
ESMPack.installStyleSheet(import.meta.resolve("../styles/inline-html-editor.global.css"));
|
|
9
9
|
export default class InlineHtmlEditor extends AtomControl {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.undoLimit = 100;
|
|
13
|
+
this.editableSelector = ".editable";
|
|
14
|
+
}
|
|
15
|
+
get htmlContent() {
|
|
16
|
+
return this.htmlTextContent.html;
|
|
17
|
+
}
|
|
18
|
+
set htmlContent(v) {
|
|
19
|
+
this.content = v;
|
|
20
|
+
}
|
|
21
|
+
get htmlTextContent() {
|
|
22
|
+
const copy = document.createElement("div");
|
|
23
|
+
copy.innerHTML = this.editor.innerHTML;
|
|
24
|
+
for (const node of descendentElementIterator(copy)) {
|
|
25
|
+
node.removeAttribute("contenteditable");
|
|
26
|
+
}
|
|
27
|
+
this.sanitizeHtml?.(copy);
|
|
28
|
+
return {
|
|
29
|
+
html: copy.innerHTML,
|
|
30
|
+
text: copy.innerText
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
get content() {
|
|
34
|
+
return this.editor.innerHTML;
|
|
35
|
+
}
|
|
36
|
+
set content(value) {
|
|
37
|
+
this.editor.innerHTML = value;
|
|
38
|
+
setTimeout(() => this.onContentSet(), 100);
|
|
39
|
+
}
|
|
40
|
+
set toolbar(v) {
|
|
41
|
+
this.dispose(this.toolbarElement);
|
|
42
|
+
this.toolbarElement.innerHTML = "";
|
|
43
|
+
this.render(v(), this.toolbarElement, this);
|
|
44
|
+
}
|
|
45
|
+
executeCommand(command, showUI, value) {
|
|
46
|
+
const selection = window.getSelection();
|
|
47
|
+
selection.removeAllRanges();
|
|
48
|
+
if (!this.selection) {
|
|
49
|
+
const range = document.createRange();
|
|
50
|
+
const start = ChildEnumerator.find(this.editor, x => x.isContentEditable) ?? this.editor.firstElementChild;
|
|
51
|
+
range.setEndAfter(start.lastChild);
|
|
52
|
+
range.setStartAfter(start.lastChild);
|
|
53
|
+
selection.addRange(range);
|
|
54
|
+
} else {
|
|
55
|
+
selection.addRange(this.selection);
|
|
56
|
+
}
|
|
57
|
+
return document.execCommand(command, showUI, value);
|
|
58
|
+
}
|
|
59
|
+
getStyle(name) {
|
|
60
|
+
const selection = this.selection;
|
|
61
|
+
if (!selection) {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
const node = selection;
|
|
65
|
+
const e = node.startContainer.parentElement;
|
|
66
|
+
return window.getComputedStyle(e)[name];
|
|
67
|
+
}
|
|
68
|
+
queryCommandState(command) {
|
|
69
|
+
return document.queryCommandState(command);
|
|
70
|
+
}
|
|
71
|
+
onContentSet() {
|
|
72
|
+
const start = Array.from(this.editor.querySelectorAll(this.editableSelector))[0] ?? this.editor.firstElementChild;
|
|
73
|
+
if (start) {
|
|
74
|
+
start.contentEditable = "true";
|
|
75
|
+
}
|
|
76
|
+
this.editor.dispatchEvent(new CustomEvent("contentReady", {
|
|
77
|
+
detail: this.editor.innerHTML,
|
|
78
|
+
bubbles: true
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
saveSelection() {
|
|
82
|
+
const selection = window.getSelection();
|
|
83
|
+
this.selection = selection.rangeCount === 0 ? null : selection.getRangeAt(0);
|
|
84
|
+
}
|
|
85
|
+
insertImage(s, e) {
|
|
86
|
+
return showImageDialog(s, e);
|
|
87
|
+
}
|
|
88
|
+
preCreate() {
|
|
89
|
+
this.version = 1;
|
|
90
|
+
this.element.setAttribute("data-inline-editor", "inline-editor");
|
|
91
|
+
this.render(XNode.create("div", null, XNode.create("div", {
|
|
92
|
+
"data-element": "toolbar"
|
|
93
|
+
}), XNode.create("div", {
|
|
94
|
+
"data-element": "editor"
|
|
95
|
+
})));
|
|
96
|
+
this.editor = this.element.querySelector(`[data-element=editor]`);
|
|
97
|
+
this.toolbarElement = this.element.querySelector(`[data-element=toolbar]`);
|
|
98
|
+
this.bindEvent(this.editor, "blur", () => this.saveSelection(), void 0, true);
|
|
99
|
+
this.bindEvent(this.editor, "input", e => this.onContentInput(e));
|
|
100
|
+
this.bindEvent(this.editor, "keydown", e => this.updateQueryCommand());
|
|
101
|
+
this.bindEvent(this.editor, "click", e => this.updateQueryCommand(e));
|
|
102
|
+
this.bindEvent(this.editor, "paste", e => this.onPasteEvent(e));
|
|
103
|
+
this.bindEvent(this.editor, "cut", () => this.onContentInput());
|
|
104
|
+
this.bindEvent(this.editor, "drop", e => this.onDrop(e));
|
|
105
|
+
}
|
|
106
|
+
updateQueryCommand(e) {
|
|
107
|
+
if (e?.type === "click") {
|
|
108
|
+
if (!this.editor.textContent) {
|
|
109
|
+
let first = this.editor.firstElementChild;
|
|
110
|
+
if (!first) {
|
|
111
|
+
first = document.createElement("div");
|
|
112
|
+
first.innerHTML = "<p><br/></p>";
|
|
113
|
+
this.editor.appendChild(first);
|
|
114
|
+
} else {
|
|
115
|
+
if (!first.lastChild) {
|
|
116
|
+
first.innerHTML = "<p></br></b>";
|
|
117
|
+
}
|
|
73
118
|
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
else {
|
|
109
|
-
if (!first.lastChild) {
|
|
110
|
-
first.innerHTML = "<p></br></b>";
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
this.version++;
|
|
116
|
-
}
|
|
117
|
-
onDrop(e) {
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
const text = e.dataTransfer.getData("text/plain");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
this.version++;
|
|
122
|
+
}
|
|
123
|
+
onDrop(e) {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
const text = e.dataTransfer.getData("text/plain");
|
|
126
|
+
if (!text) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
let last = null;
|
|
130
|
+
for (const node of descendentElementIterator(this.element)) {
|
|
131
|
+
if (node.isContentEditable) {
|
|
132
|
+
last = node;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (last) {
|
|
137
|
+
last.appendChild(document.createTextNode(text));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
onPasteEvent(e) {
|
|
141
|
+
if (!e.clipboardData.types.find(x => x === "text/html")) {
|
|
142
|
+
this.onContentInput();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const d = e.clipboardData.getData("text/plain");
|
|
146
|
+
if (d) {
|
|
147
|
+
const s = window.getSelection();
|
|
148
|
+
const r = s.getRangeAt(0);
|
|
149
|
+
let last;
|
|
150
|
+
const tags = [];
|
|
151
|
+
for (const iterator of d.split("\n")) {
|
|
152
|
+
const text = iterator.trim();
|
|
120
153
|
if (!text) {
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
let last = null;
|
|
124
|
-
for (const node of descendentElementIterator(this.element)) {
|
|
125
|
-
if (node.isContentEditable) {
|
|
126
|
-
last = node;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
154
|
+
continue;
|
|
129
155
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
e.preventDefault();
|
|
161
|
-
}
|
|
162
|
-
contentModified() {
|
|
163
|
-
this.element.dispatchEvent(new CustomEvent("contentChanged", { detail: this.editor.innerHTML, bubbles: true }));
|
|
164
|
-
}
|
|
165
|
-
onContentInput(e) {
|
|
166
|
-
this.token?.cancel();
|
|
167
|
-
const token = this.token = new CancelToken();
|
|
168
|
-
this.app.runAsync(async () => {
|
|
169
|
-
await sleep(500, token, false);
|
|
170
|
-
if (token.cancelled) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
this.contentModified();
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
//# sourceMappingURL=InlineHtmlEditor.js.map
|
|
156
|
+
last = document.createElement("p");
|
|
157
|
+
last.innerText = iterator;
|
|
158
|
+
tags.push(last);
|
|
159
|
+
}
|
|
160
|
+
while (tags.length) {
|
|
161
|
+
r.insertNode(tags.pop());
|
|
162
|
+
}
|
|
163
|
+
r.setStartAfter(last);
|
|
164
|
+
this.onContentInput();
|
|
165
|
+
}
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
}
|
|
168
|
+
contentModified() {
|
|
169
|
+
this.element.dispatchEvent(new CustomEvent("contentChanged", {
|
|
170
|
+
detail: this.editor.innerHTML,
|
|
171
|
+
bubbles: true
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
onContentInput(e) {
|
|
175
|
+
this.token?.cancel();
|
|
176
|
+
const token = this.token = new CancelToken();
|
|
177
|
+
this.app.runAsync(async () => {
|
|
178
|
+
await sleep(500, token, false);
|
|
179
|
+
if (token.cancelled) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this.contentModified();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -1,61 +1,59 @@
|
|
|
1
|
-
export const checkAnyParent =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
e = e.parentElement;
|
|
1
|
+
export const checkAnyParent = check => e => {
|
|
2
|
+
while (e) {
|
|
3
|
+
if (check(e)) {
|
|
4
|
+
return true;
|
|
7
5
|
}
|
|
8
|
-
|
|
6
|
+
e = e.parentElement;
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
9
|
};
|
|
10
10
|
export default class RangeEditor {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
static updateAttribute(range, name, value, anyParent = true) {
|
|
12
|
+
return this.updateRange({
|
|
13
|
+
range,
|
|
14
|
+
check: anyParent ? checkAnyParent(e => e.getAttribute(name) === value) : e => e.getAttribute(name) === value,
|
|
15
|
+
update: e => (e.setAttribute(name, value), e)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
static checkRange({
|
|
19
|
+
range,
|
|
20
|
+
check
|
|
21
|
+
}) {
|
|
22
|
+
const root = range.startContainer.nodeType !== Node.ELEMENT_NODE ? range.startContainer.parentElement : range.startContainer;
|
|
23
|
+
return check(root);
|
|
24
|
+
}
|
|
25
|
+
static updateRange({
|
|
26
|
+
range,
|
|
27
|
+
check,
|
|
28
|
+
update,
|
|
29
|
+
value
|
|
30
|
+
}) {}
|
|
28
31
|
}
|
|
29
32
|
const updateAttribute = (name, value, anyParent = true) => ({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
? checkAnyParent((e) => e.getAttribute(name) === value)
|
|
33
|
-
: (e) => e.getAttribute(name) === value
|
|
33
|
+
update: (e, v = value) => (e.setAttribute(name, v), e),
|
|
34
|
+
check: anyParent ? checkAnyParent(e => e.getAttribute(name) === value) : e => e.getAttribute(name) === value
|
|
34
35
|
});
|
|
35
36
|
const updateStyle = (name, value, anyParent = true) => ({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
? checkAnyParent((e) => e.style[name] === value)
|
|
39
|
-
: (e) => e.style[name] === value
|
|
37
|
+
update: (e, v = value) => (e.style[name] = v, e),
|
|
38
|
+
check: anyParent ? checkAnyParent(e => e.style[name] === value) : e => e.style[name] === value
|
|
40
39
|
});
|
|
41
40
|
export const RangeEditorCommands = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
removeFormat: {
|
|
54
|
-
check: () => false,
|
|
55
|
-
update: (e) => {
|
|
56
|
-
e.removeAttribute("style");
|
|
57
|
-
return e;
|
|
58
|
-
}
|
|
41
|
+
bold: updateStyle("fontWeight", "bold"),
|
|
42
|
+
italic: updateStyle("fontStyle", "italic"),
|
|
43
|
+
underline: updateStyle("textDecoration", "underline"),
|
|
44
|
+
strikeThrough: updateStyle("textDecoration", "line-through"),
|
|
45
|
+
foreColor: {
|
|
46
|
+
check: () => false,
|
|
47
|
+
update: (e, value) => {
|
|
48
|
+
e.style.color = value;
|
|
49
|
+
return e;
|
|
59
50
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
51
|
+
},
|
|
52
|
+
removeFormat: {
|
|
53
|
+
check: () => false,
|
|
54
|
+
update: e => {
|
|
55
|
+
e.removeAttribute("style");
|
|
56
|
+
return e;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -7,42 +7,47 @@ import FormField from "../../basic/FormField.js";
|
|
|
7
7
|
import CommandButton from "./CommandButton.js";
|
|
8
8
|
import HtmlCommands from "./HtmlCommands.js";
|
|
9
9
|
class ImageDialog extends PopupWindow {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
create() {
|
|
11
|
+
this.link = "";
|
|
12
|
+
this.alt = "";
|
|
13
|
+
this.render(XNode.create("div", null, XNode.create(FormField, {
|
|
14
|
+
label: "Url"
|
|
15
|
+
}, XNode.create("input", {
|
|
16
|
+
value: Bind.twoWaysImmediate(() => this.link)
|
|
17
|
+
})), XNode.create(FormField, {
|
|
18
|
+
label: "Alt"
|
|
19
|
+
}, XNode.create("input", {
|
|
20
|
+
value: Bind.twoWaysImmediate(() => this.alt)
|
|
21
|
+
})), XNode.create("div", {
|
|
22
|
+
class: "command-bar"
|
|
23
|
+
}, XNode.create("button", {
|
|
24
|
+
eventClick: () => this.close(this.createImage()),
|
|
25
|
+
text: "Add"
|
|
26
|
+
}))));
|
|
27
|
+
}
|
|
28
|
+
createImage() {
|
|
29
|
+
if (this.alt) {
|
|
30
|
+
return `<img src="${this.link}" alt="${this.alt}" />`;
|
|
26
31
|
}
|
|
32
|
+
return `<img src="${this.link}"/>`;
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
|
-
__decorate([
|
|
29
|
-
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], ImageDialog.prototype, "link", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
BindableProperty,
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], ImageDialog.prototype, "alt", void 0);
|
|
35
|
+
__decorate([BindableProperty, __metadata("design:type", String)], ImageDialog.prototype, "link", void 0);
|
|
36
|
+
__decorate([BindableProperty, __metadata("design:type", String)], ImageDialog.prototype, "alt", void 0);
|
|
36
37
|
export function showImageDialog(s, e) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return CommandButton({
|
|
41
|
-
icon: "ri-image-add-fill",
|
|
42
|
-
insertCommand,
|
|
43
|
-
disabled: false,
|
|
44
|
-
title: "Insert Image",
|
|
45
|
-
eventInsertHtml
|
|
46
|
-
});
|
|
38
|
+
return PopupService.showWindow(e.currentTarget, ImageDialog, {
|
|
39
|
+
title: "Add Image"
|
|
40
|
+
});
|
|
47
41
|
}
|
|
48
|
-
|
|
42
|
+
export default function AddImage({
|
|
43
|
+
eventInsertHtml = (s, e) => s.insertImage(s, e),
|
|
44
|
+
insertCommand = HtmlCommands.insertImage
|
|
45
|
+
}) {
|
|
46
|
+
return CommandButton({
|
|
47
|
+
icon: "ri-image-add-fill",
|
|
48
|
+
insertCommand,
|
|
49
|
+
disabled: false,
|
|
50
|
+
title: "Insert Image",
|
|
51
|
+
eventInsertHtml
|
|
52
|
+
});
|
|
53
|
+
}
|