@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
|
@@ -28,176 +28,176 @@ import Unlink from "./commands/Unlink.js";
|
|
|
28
28
|
import UnorderedList from "./commands/UnorderedList.js";
|
|
29
29
|
import Toolbar from "./commands/Toolbar.js";
|
|
30
30
|
export { default as Toolbar } from "./commands/Toolbar.js";
|
|
31
|
-
import
|
|
31
|
+
ESMPack.installStyleSheet(import.meta.resolve("../styles/atom-html-editor.global.css"));
|
|
32
32
|
const link = document.createElement("link");
|
|
33
33
|
link.href = "https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css";
|
|
34
34
|
link.rel = "preload";
|
|
35
35
|
link.as = "style";
|
|
36
36
|
link.onload = () => {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
link.onload = null;
|
|
38
|
+
link.rel = "stylesheet";
|
|
39
39
|
};
|
|
40
40
|
document.head.appendChild(link);
|
|
41
41
|
function preventLinkClick(e, editor, doc) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
if (target === body) {
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
if (target.isContentEditable) {
|
|
52
|
-
editor.dispatchEvent(new MouseEvent("click", {
|
|
53
|
-
bubbles: true,
|
|
54
|
-
cancelable: true
|
|
55
|
-
}));
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (target.tagName === "A") {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
}
|
|
61
|
-
target = target.parentElement;
|
|
42
|
+
let target = e.target;
|
|
43
|
+
const body = doc.body;
|
|
44
|
+
while (target) {
|
|
45
|
+
if (target.getAttribute("data-prompt")) {
|
|
46
|
+
break;
|
|
62
47
|
}
|
|
63
|
-
target
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
while (target) {
|
|
71
|
-
const value = target.dataset[p];
|
|
72
|
-
if (value !== void 0) {
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
target = target.parentElement;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
editor.dispatchEvent(new CustomEvent("editorClick", {
|
|
80
|
-
detail: {
|
|
81
|
-
target,
|
|
82
|
-
data
|
|
83
|
-
},
|
|
84
|
-
bubbles: true,
|
|
85
|
-
cancelable: true
|
|
86
|
-
}));
|
|
87
|
-
editor.dispatchEvent(new MouseEvent("click", {
|
|
48
|
+
if (target === body) {
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
if (target.isContentEditable) {
|
|
52
|
+
editor.dispatchEvent(new MouseEvent("click", {
|
|
88
53
|
bubbles: true,
|
|
89
54
|
cancelable: true
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export default class AtomHtmlEditor extends AtomControl {
|
|
93
|
-
get htmlContent() {
|
|
94
|
-
try {
|
|
95
|
-
return this.editor?.innerHTML ?? this.initialContent;
|
|
96
|
-
}
|
|
97
|
-
catch (ex) {
|
|
98
|
-
console.warn(ex);
|
|
99
|
-
}
|
|
55
|
+
}));
|
|
56
|
+
return;
|
|
100
57
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
58
|
+
if (target.tagName === "A") {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
}
|
|
61
|
+
target = target.parentElement;
|
|
62
|
+
}
|
|
63
|
+
target = e.target;
|
|
64
|
+
const originalTarget = target;
|
|
65
|
+
const data = new Proxy(originalTarget, {
|
|
66
|
+
get(target, p) {
|
|
67
|
+
if (typeof p !== "string") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
while (target) {
|
|
71
|
+
const value = target.dataset[p];
|
|
72
|
+
if (value !== void 0) {
|
|
73
|
+
return value;
|
|
107
74
|
}
|
|
108
|
-
|
|
75
|
+
target = target.parentElement;
|
|
76
|
+
}
|
|
109
77
|
}
|
|
110
|
-
|
|
111
|
-
|
|
78
|
+
});
|
|
79
|
+
editor.dispatchEvent(new CustomEvent("editorClick", {
|
|
80
|
+
detail: {
|
|
81
|
+
target,
|
|
82
|
+
data
|
|
83
|
+
},
|
|
84
|
+
bubbles: true,
|
|
85
|
+
cancelable: true
|
|
86
|
+
}));
|
|
87
|
+
editor.dispatchEvent(new MouseEvent("click", {
|
|
88
|
+
bubbles: true,
|
|
89
|
+
cancelable: true
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
export default class AtomHtmlEditor extends AtomControl {
|
|
93
|
+
get htmlContent() {
|
|
94
|
+
try {
|
|
95
|
+
return this.editor?.innerHTML ?? this.initialContent;
|
|
96
|
+
} catch (ex) {
|
|
97
|
+
console.warn(ex);
|
|
112
98
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
}
|
|
100
|
+
set htmlContent(v) {
|
|
101
|
+
if (this.editor) {
|
|
102
|
+
this.editor.innerHTML = v;
|
|
103
|
+
} else {
|
|
104
|
+
this.initialContent = v;
|
|
117
105
|
}
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
AtomBinder.refreshValue(this, "htmlContent");
|
|
107
|
+
}
|
|
108
|
+
insertImage(s, e) {
|
|
109
|
+
return showImageDialog(s, e);
|
|
110
|
+
}
|
|
111
|
+
executeCommand(cmd, showUI, value) {
|
|
112
|
+
const r = this.editorDocument.execCommand(cmd, showUI, value);
|
|
113
|
+
setTimeout(() => this.version++, 1);
|
|
114
|
+
return r;
|
|
115
|
+
}
|
|
116
|
+
queryCommandState(cmd, ...a) {
|
|
117
|
+
return this.editorDocument.queryCommandState(cmd);
|
|
118
|
+
}
|
|
119
|
+
getStyle(name, v) {
|
|
120
|
+
try {
|
|
121
|
+
const node = this.editorWindow.getSelection().getRangeAt(0);
|
|
122
|
+
const e = node.startContainer.parentElement;
|
|
123
|
+
return this.editorWindow.getComputedStyle(e)[name];
|
|
124
|
+
} catch (ex) {
|
|
125
|
+
return null;
|
|
120
126
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
catch (ex) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
127
|
+
}
|
|
128
|
+
onPropertyChanged(name) {
|
|
129
|
+
super.onPropertyChanged(name);
|
|
130
|
+
if (name === "tags") {
|
|
131
|
+
this.setupTags();
|
|
130
132
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
}
|
|
134
|
+
setupTags() {
|
|
135
|
+
const doc = this.editorDocument;
|
|
136
|
+
if (!doc) {
|
|
137
|
+
return;
|
|
136
138
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const styleElement = doc.createElement("style");
|
|
146
|
-
styleElement.textContent = `*[data-command=${name}] {
|
|
139
|
+
if (Array.isArray(this.tags)) {
|
|
140
|
+
for (const {
|
|
141
|
+
name,
|
|
142
|
+
style
|
|
143
|
+
} of this.tags) {
|
|
144
|
+
if (style) {
|
|
145
|
+
const styleElement = doc.createElement("style");
|
|
146
|
+
styleElement.textContent = `*[data-command=${name}] {
|
|
147
147
|
${style.toStyleSheet()}
|
|
148
148
|
}`;
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
}
|
|
149
|
+
doc.head.appendChild(styleElement);
|
|
152
150
|
}
|
|
151
|
+
}
|
|
153
152
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
}
|
|
154
|
+
preCreate() {
|
|
155
|
+
this.version = 1;
|
|
156
|
+
this.files = [];
|
|
157
|
+
this.runAfterInit(() => {
|
|
158
|
+
this.setup();
|
|
159
|
+
});
|
|
160
|
+
this.element.classList.add("atom-control-html-editor");
|
|
161
|
+
this.element.classList.add("html-editor");
|
|
162
|
+
}
|
|
163
|
+
onPasteEvent(e) {
|
|
164
|
+
if (!e.clipboardData.types.find(x => x === "text/html")) {
|
|
165
|
+
return;
|
|
162
166
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
const d = e.clipboardData.getData("text/plain");
|
|
168
|
+
if (d) {
|
|
169
|
+
const s = window.getSelection();
|
|
170
|
+
const r = s.getRangeAt(0);
|
|
171
|
+
let last;
|
|
172
|
+
const tags = [];
|
|
173
|
+
for (const iterator of d.split("\n")) {
|
|
174
|
+
const text = iterator.trim();
|
|
175
|
+
if (!text) {
|
|
176
|
+
continue;
|
|
166
177
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (!text) {
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
last = document.createElement("p");
|
|
179
|
-
last.innerText = iterator;
|
|
180
|
-
tags.push(last);
|
|
181
|
-
}
|
|
182
|
-
while (tags.length) {
|
|
183
|
-
r.insertNode(tags.pop());
|
|
184
|
-
}
|
|
185
|
-
r.setStartAfter(last);
|
|
186
|
-
}
|
|
187
|
-
e.preventDefault();
|
|
188
|
-
}
|
|
189
|
-
onInputEvent(e) {
|
|
190
|
-
console.log(e);
|
|
178
|
+
last = document.createElement("p");
|
|
179
|
+
last.innerText = iterator;
|
|
180
|
+
tags.push(last);
|
|
181
|
+
}
|
|
182
|
+
while (tags.length) {
|
|
183
|
+
r.insertNode(tags.pop());
|
|
184
|
+
}
|
|
185
|
+
r.setStartAfter(last);
|
|
191
186
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
}
|
|
189
|
+
onInputEvent(e) {
|
|
190
|
+
console.log(e);
|
|
191
|
+
}
|
|
192
|
+
setup() {
|
|
193
|
+
const frame = this.element.getElementsByTagName("iframe")[0];
|
|
194
|
+
const doc = frame.contentWindow.document;
|
|
195
|
+
doc.open();
|
|
196
|
+
const baseUrl = `${location.protocol}//${location.host}`;
|
|
197
|
+
doc.writeln(`<base href="${baseUrl}"></base><div id="editor"><p> </p></div>`);
|
|
198
|
+
doc.close();
|
|
199
|
+
const style = doc.createElement("style");
|
|
200
|
+
style.textContent = `body {
|
|
201
201
|
font-family: arial,sans-serif
|
|
202
202
|
}
|
|
203
203
|
#editor {
|
|
@@ -207,131 +207,106 @@ export default class AtomHtmlEditor extends AtomControl {
|
|
|
207
207
|
background: yellow
|
|
208
208
|
}
|
|
209
209
|
`;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
if (this.tags) {
|
|
264
|
-
for (const { name, handler } of this.tags) {
|
|
265
|
-
if (name === data.command || name === data.clickEvent) {
|
|
266
|
-
handler(ce);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
210
|
+
doc.head.appendChild(style);
|
|
211
|
+
doc.body.addEventListener("click", e => preventLinkClick(e, this.element, doc));
|
|
212
|
+
this.editor = doc.getElementById("editor");
|
|
213
|
+
this.editor.contentEditable = "true";
|
|
214
|
+
this.editor.innerHTML = this.initialContent ?? "";
|
|
215
|
+
doc.execCommand("styleWithCSS");
|
|
216
|
+
doc.execCommand("insertBrOnReturn");
|
|
217
|
+
const updateVersion = () => setTimeout(() => {
|
|
218
|
+
this.version++;
|
|
219
|
+
AtomBinder.refreshValue(this, "htmlContent");
|
|
220
|
+
this.element.dispatchEvent(new CustomEvent("documentUpdated", {
|
|
221
|
+
detail: this.editor
|
|
222
|
+
}));
|
|
223
|
+
this.documentUpdated(this.editor);
|
|
224
|
+
}, 1);
|
|
225
|
+
this.editor.addEventListener("click", updateVersion);
|
|
226
|
+
this.editor.addEventListener("keydown", updateVersion);
|
|
227
|
+
this.editor.addEventListener("keypress", updateVersion);
|
|
228
|
+
this.editor.addEventListener("input", updateVersion);
|
|
229
|
+
this.editorWindow = frame.contentWindow;
|
|
230
|
+
this.editorDocument = doc;
|
|
231
|
+
updateVersion();
|
|
232
|
+
this.documentCreated(this.editor);
|
|
233
|
+
this.element.dispatchEvent(new CustomEvent("documentCreated", {
|
|
234
|
+
detail: this.editor
|
|
235
|
+
}));
|
|
236
|
+
this.registerDisposable({
|
|
237
|
+
dispose: () => {
|
|
238
|
+
this.editor.removeEventListener("click", updateVersion);
|
|
239
|
+
this.editor.removeEventListener("keydown", updateVersion);
|
|
240
|
+
this.editor.removeEventListener("keypress", updateVersion);
|
|
241
|
+
this.editor.removeEventListener("input", updateVersion);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
this.bindEvent(this.element, "editorClick", ce => {
|
|
245
|
+
const {
|
|
246
|
+
detail: {
|
|
247
|
+
data,
|
|
248
|
+
target
|
|
249
|
+
}
|
|
250
|
+
} = ce;
|
|
251
|
+
if (data.prompt) {
|
|
252
|
+
const element = target;
|
|
253
|
+
const result = prompt("Enter " + (data.promptTitle ?? data.prompt), data.promptDefault);
|
|
254
|
+
if (result) {
|
|
255
|
+
const replace = (data.replace ?? "textContent").split(",").map(x => x.trim());
|
|
256
|
+
for (const iterator of replace) {
|
|
257
|
+
const template = element.getAttribute("data-" + iterator + "-template") || element.getAttribute("data-template");
|
|
258
|
+
if (template) {
|
|
259
|
+
element[iterator] = template.replace(data.prompt, result);
|
|
260
|
+
} else {
|
|
261
|
+
element[iterator] = result;
|
|
269
262
|
}
|
|
270
|
-
|
|
271
|
-
this.setupTags();
|
|
272
|
-
}
|
|
273
|
-
documentCreated(e) {
|
|
274
|
-
}
|
|
275
|
-
documentUpdated(e) {
|
|
276
|
-
}
|
|
277
|
-
render(node, e, creator) {
|
|
278
|
-
this.render = super.render;
|
|
279
|
-
if (!node.children || node.children.length === 0) {
|
|
280
|
-
node.children[0] = XNode.create(Toolbar, null,
|
|
281
|
-
XNode.create(Bold, null),
|
|
282
|
-
XNode.create(Italic, null),
|
|
283
|
-
XNode.create(Underline, null),
|
|
284
|
-
XNode.create(StrikeThrough, null),
|
|
285
|
-
XNode.create(Align, null),
|
|
286
|
-
XNode.create(Separator, null),
|
|
287
|
-
XNode.create(Headings, null),
|
|
288
|
-
XNode.create(ChangeColor, null),
|
|
289
|
-
XNode.create(HorizontalRule, null),
|
|
290
|
-
XNode.create(Separator, null),
|
|
291
|
-
XNode.create(ChangeFont, null),
|
|
292
|
-
XNode.create(ChangeFontSize, null),
|
|
293
|
-
XNode.create(Separator, null),
|
|
294
|
-
XNode.create(NumberedList, null),
|
|
295
|
-
XNode.create(UnorderedList, null),
|
|
296
|
-
XNode.create(IndentLess, null),
|
|
297
|
-
XNode.create(IndentMore, null),
|
|
298
|
-
XNode.create(Separator, null),
|
|
299
|
-
XNode.create(AddImage, null),
|
|
300
|
-
XNode.create(AttachFile, null),
|
|
301
|
-
XNode.create(Separator, null),
|
|
302
|
-
XNode.create(AddLink, null),
|
|
303
|
-
XNode.create(Unlink, null),
|
|
304
|
-
XNode.create(RemoveFormat, null),
|
|
305
|
-
XNode.create(Separator, null),
|
|
306
|
-
XNode.create(Source, null));
|
|
263
|
+
}
|
|
307
264
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (this.tags) {
|
|
268
|
+
for (const {
|
|
269
|
+
name,
|
|
270
|
+
handler
|
|
271
|
+
} of this.tags) {
|
|
272
|
+
if (name === data.command || name === data.clickEvent) {
|
|
273
|
+
handler(ce);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
this.setupTags();
|
|
279
|
+
}
|
|
280
|
+
documentCreated(e) {}
|
|
281
|
+
documentUpdated(e) {}
|
|
282
|
+
render(node, e, creator) {
|
|
283
|
+
this.render = super.render;
|
|
284
|
+
if (!node.children || node.children.length === 0) {
|
|
285
|
+
node.children[0] = XNode.create(Toolbar, null, XNode.create(Bold, null), XNode.create(Italic, null), XNode.create(Underline, null), XNode.create(StrikeThrough, null), XNode.create(Align, null), XNode.create(Separator, null), XNode.create(Headings, null), XNode.create(ChangeColor, null), XNode.create(HorizontalRule, null), XNode.create(Separator, null), XNode.create(ChangeFont, null), XNode.create(ChangeFontSize, null), XNode.create(Separator, null), XNode.create(NumberedList, null), XNode.create(UnorderedList, null), XNode.create(IndentLess, null), XNode.create(IndentMore, null), XNode.create(Separator, null), XNode.create(AddImage, null), XNode.create(AttachFile, null), XNode.create(Separator, null), XNode.create(AddLink, null), XNode.create(Unlink, null), XNode.create(RemoveFormat, null), XNode.create(Separator, null), XNode.create(Source, null));
|
|
315
286
|
}
|
|
287
|
+
super.render(XNode.create("div", {
|
|
288
|
+
...node.attributes
|
|
289
|
+
}, ...node.children, XNode.create(AtomRepeater, {
|
|
290
|
+
class: "files",
|
|
291
|
+
"event-item-delete": ce => this.files.remove(ce.detail),
|
|
292
|
+
items: Bind.oneWay(() => this.files),
|
|
293
|
+
itemRenderer: file => XNode.create("div", {
|
|
294
|
+
class: "file"
|
|
295
|
+
}, XNode.create("i", {
|
|
296
|
+
class: "ri-attachment-2"
|
|
297
|
+
}), XNode.create("label", {
|
|
298
|
+
text: file.name
|
|
299
|
+
}), XNode.create("i", {
|
|
300
|
+
"data-click-event": "item-delete",
|
|
301
|
+
class: "ri-close-circle-fill"
|
|
302
|
+
}))
|
|
303
|
+
}), XNode.create("iframe", {
|
|
304
|
+
class: "editor-frame"
|
|
305
|
+
})));
|
|
306
|
+
}
|
|
316
307
|
}
|
|
317
|
-
__decorate([
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
], AtomHtmlEditor.prototype, "
|
|
321
|
-
__decorate([
|
|
322
|
-
BindableProperty,
|
|
323
|
-
__metadata("design:type", Array)
|
|
324
|
-
], AtomHtmlEditor.prototype, "header", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
BindableProperty,
|
|
327
|
-
__metadata("design:type", Number)
|
|
328
|
-
], AtomHtmlEditor.prototype, "version", void 0);
|
|
329
|
-
__decorate([
|
|
330
|
-
BindableProperty,
|
|
331
|
-
__metadata("design:type", Array)
|
|
332
|
-
], AtomHtmlEditor.prototype, "files", void 0);
|
|
333
|
-
__decorate([
|
|
334
|
-
BindableProperty,
|
|
335
|
-
__metadata("design:type", Array)
|
|
336
|
-
], AtomHtmlEditor.prototype, "tags", void 0);
|
|
337
|
-
//# sourceMappingURL=AtomHtmlEditor.js.map
|
|
308
|
+
__decorate([BindableProperty, __metadata("design:type", String)], AtomHtmlEditor.prototype, "content", void 0);
|
|
309
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], AtomHtmlEditor.prototype, "header", void 0);
|
|
310
|
+
__decorate([BindableProperty, __metadata("design:type", Number)], AtomHtmlEditor.prototype, "version", void 0);
|
|
311
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], AtomHtmlEditor.prototype, "files", void 0);
|
|
312
|
+
__decorate([BindableProperty, __metadata("design:type", Array)], AtomHtmlEditor.prototype, "tags", void 0);
|