@zipify/wysiwyg 1.0.0-dev.9 → 1.0.0-dev.90
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/.editorconfig +1 -1
- package/.eslintrc.js +2 -2
- package/.github/dependabot.yaml +1 -0
- package/.lintstagedrc +2 -2
- package/.release-it.json +3 -1
- package/.stylelintrc +0 -4
- package/README.md +2 -2
- package/config/jest/setupTests.js +0 -3
- package/config/vite/example.config.js +25 -0
- package/config/vite/lib.config.js +30 -0
- package/config/{webpack → vite}/settings.js +0 -0
- package/dist/wysiwyg.css +404 -373
- package/dist/wysiwyg.mjs +26014 -0
- package/example/ExampleApp.vue +35 -4
- package/example/example.js +0 -3
- package/example/{example.html → index.html} +1 -0
- package/example/pageBlocks.js +31 -0
- package/example/presets.js +2 -2
- package/example/tooltip/Tooltip.js +1 -1
- package/jest.config.js +3 -1
- package/lib/Wysiwyg.vue +73 -14
- package/lib/__tests__/utils/index.js +0 -1
- package/lib/__tests__/utils/withComponentContext.js +1 -1
- package/lib/assets/icons/background-color.svg +3 -1
- package/lib/assets/icons/font-color.svg +1 -3
- package/lib/assets/icons/link.svg +3 -0
- package/lib/assets/icons/unlink.svg +3 -0
- package/lib/components/base/Button.vue +23 -2
- package/lib/components/base/Checkbox.vue +89 -0
- package/lib/components/base/FieldLabel.vue +2 -1
- package/lib/components/base/Icon.vue +3 -3
- package/lib/components/base/Modal.vue +1 -2
- package/lib/components/base/NumberField.vue +2 -2
- package/lib/components/base/Range.vue +1 -1
- package/lib/components/base/ScrollView.vue +1 -3
- package/lib/components/base/TextField.vue +108 -0
- package/lib/components/base/__tests__/Modal.test.js +7 -2
- package/lib/components/base/__tests__/TextField.test.js +57 -0
- package/lib/components/base/__tests__/__snapshots__/TextField.test.js.snap +9 -0
- package/lib/components/base/colorPicker/ColorPicker.vue +14 -12
- package/lib/components/base/colorPicker/composables/__tests__/usePickerApi.test.js +6 -6
- package/lib/components/base/colorPicker/composables/usePickerApi.js +15 -8
- package/lib/components/base/colorPicker/composables/usePickerHotkeys.js +3 -2
- package/lib/components/base/composables/__tests__/useActivatedListener.test.js +1 -1
- package/lib/components/base/composables/__tests__/useDeselectionLock.test.js +1 -1
- package/lib/components/base/composables/__tests__/useElementRef.test.js +1 -1
- package/lib/components/base/composables/__tests__/useModalToggler.test.js +1 -1
- package/lib/components/base/composables/__tests__/useNumberValue.test.js +1 -1
- package/lib/components/base/composables/__tests__/useScrollView.test.js +1 -1
- package/lib/components/base/composables/__tests__/useTempValue.test.js +1 -1
- package/lib/components/base/composables/__tests__/useValidator.test.js +44 -0
- package/lib/components/base/composables/index.js +1 -0
- package/lib/components/base/composables/useActivatedListener.js +1 -1
- package/lib/components/base/composables/useDeselectionLock.js +1 -1
- package/lib/components/base/composables/useElementRef.js +1 -1
- package/lib/components/base/composables/useModalToggler.js +6 -2
- package/lib/components/base/composables/useScrollView.js +1 -1
- package/lib/components/base/composables/useTempValue.js +1 -1
- package/lib/components/base/composables/useValidator.js +23 -0
- package/lib/components/base/dropdown/Dropdown.vue +16 -4
- package/lib/components/base/dropdown/DropdownActivator.vue +19 -3
- package/lib/components/base/dropdown/DropdownGroup.vue +1 -1
- package/lib/components/base/dropdown/DropdownMenu.vue +1 -1
- package/lib/components/base/dropdown/DropdownOption.vue +1 -1
- package/lib/components/base/dropdown/__tests__/DropdownActivator.test.js +1 -1
- package/lib/components/base/dropdown/__tests__/DropdownMenu.test.js +1 -1
- package/lib/components/base/dropdown/__tests__/DropdownOption.test.js +1 -1
- package/lib/components/base/dropdown/composables/__tests__/useActiveOptionManager.test.js +1 -1
- package/lib/components/base/dropdown/composables/__tests__/useDropdownEntityTitle.test.js +1 -1
- package/lib/components/base/dropdown/composables/useActiveOptionManager.js +1 -1
- package/lib/components/base/dropdown/composables/useDropdownEntityTitle.js +1 -1
- package/lib/components/base/index.js +3 -1
- package/lib/components/toolbar/Toolbar.vue +51 -9
- package/lib/components/toolbar/ToolbarDivider.vue +1 -1
- package/lib/components/toolbar/ToolbarFull.vue +41 -10
- package/lib/components/toolbar/ToolbarRow.vue +1 -0
- package/lib/components/toolbar/__tests__/Toolbar.test.js +6 -0
- package/lib/components/toolbar/controls/AlignmentControl.vue +1 -1
- package/lib/components/toolbar/controls/AlignmentDeviceControl.vue +1 -1
- package/lib/components/toolbar/controls/BackgroundColorControl.vue +1 -1
- package/lib/components/toolbar/controls/CaseStyleControl.vue +1 -1
- package/lib/components/toolbar/controls/FontColorControl.vue +1 -1
- package/lib/components/toolbar/controls/FontFamilyControl.vue +1 -1
- package/lib/components/toolbar/controls/FontSizeControl.vue +8 -1
- package/lib/components/toolbar/controls/FontWeightControl.vue +1 -1
- package/lib/components/toolbar/controls/ItalicControl.vue +1 -1
- package/lib/components/toolbar/controls/LineHeightControl.vue +1 -1
- package/lib/components/toolbar/controls/ListControl.vue +68 -34
- package/lib/components/toolbar/controls/RemoveFormatControl.vue +1 -1
- package/lib/components/toolbar/controls/StrikeThroughControl.vue +1 -1
- package/lib/components/toolbar/controls/StylePresetControl.vue +15 -2
- package/lib/components/toolbar/controls/SuperscriptControl.vue +1 -1
- package/lib/components/toolbar/controls/UnderlineControl.vue +2 -2
- package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/AlignmentDeviceControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/BackgroundColorControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontColorControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontFamilyControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontSizeControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontWeightControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/ItalicControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/ListControl.test.js +18 -3
- package/lib/components/toolbar/controls/__tests__/StrikeThroughControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +17 -1
- package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +5 -1
- package/lib/components/toolbar/controls/composables/useRecentFonts.js +1 -1
- package/lib/components/toolbar/controls/index.js +1 -0
- package/lib/components/toolbar/controls/link/LinkControl.vue +160 -0
- package/lib/components/toolbar/controls/link/LinkControlApply.vue +35 -0
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +69 -0
- package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +79 -0
- package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +42 -0
- package/lib/components/toolbar/controls/link/composables/__tests__/__snapshots__/useLink.test.js.snap +15 -0
- package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +172 -0
- package/lib/components/toolbar/controls/link/composables/index.js +1 -0
- package/lib/components/toolbar/controls/link/composables/useLink.js +82 -0
- package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +103 -0
- package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +54 -0
- package/lib/components/toolbar/controls/link/destination/LinkControlUrl.vue +52 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/LinkControlPageBlock.test.js +36 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/LinkControlUrl.test.js +46 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/__snapshots__/LinkControlPageBlock.test.js.snap +9 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/__snapshots__/LinkControlUrl.test.js.snap +17 -0
- package/lib/components/toolbar/controls/link/destination/index.js +1 -0
- package/lib/components/toolbar/controls/link/index.js +1 -0
- package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +1 -0
- package/lib/composables/__tests__/useEditor.test.js +5 -4
- package/lib/composables/useEditor.js +12 -9
- package/lib/composables/useToolbar.js +26 -19
- package/lib/directives/__tests__/outClick.test.js +6 -0
- package/lib/directives/outClick.js +19 -6
- package/lib/enums/Alignments.js +10 -1
- package/lib/enums/LinkDestinations.js +4 -0
- package/lib/enums/LinkTargets.js +4 -0
- package/lib/enums/TextSettings.js +3 -1
- package/lib/enums/index.js +2 -0
- package/lib/extensions/Alignment.js +22 -8
- package/lib/extensions/BackgroundColor.js +15 -7
- package/lib/extensions/DeviceManager.js +2 -5
- package/lib/extensions/FontColor.js +15 -7
- package/lib/extensions/FontFamily.js +26 -9
- package/lib/extensions/FontSize.js +33 -13
- package/lib/extensions/FontStyle.js +24 -14
- package/lib/extensions/FontWeight.js +25 -15
- package/lib/extensions/LineHeight.js +33 -29
- package/lib/extensions/Link.js +90 -0
- package/lib/extensions/StylePreset.js +20 -19
- package/lib/extensions/Superscript.js +5 -1
- package/lib/extensions/TextDecoration.js +46 -13
- package/lib/extensions/__tests__/Alignment.test.js +14 -9
- package/lib/extensions/__tests__/BackgroundColor.test.js +13 -8
- package/lib/extensions/__tests__/CaseStyle.test.js +4 -7
- package/lib/extensions/__tests__/FontColor.test.js +13 -8
- package/lib/extensions/__tests__/FontFamily.test.js +34 -10
- package/lib/extensions/__tests__/FontSize.test.js +16 -10
- package/lib/extensions/__tests__/FontStyle.test.js +13 -8
- package/lib/extensions/__tests__/FontWeight.test.js +21 -8
- package/lib/extensions/__tests__/LineHeight.test.js +25 -14
- package/lib/extensions/__tests__/Link.test.js +101 -0
- package/lib/extensions/__tests__/StylePreset.test.js +72 -10
- package/lib/extensions/__tests__/TextDecoration.test.js +53 -8
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +26 -2
- package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +30 -1
- package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +18 -1
- package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +88 -1
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +33 -2
- package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +25 -4
- package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +47 -1
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +26 -2
- package/lib/extensions/__tests__/__snapshots__/Link.test.js.snap +225 -0
- package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +6 -2
- package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +183 -3
- package/lib/extensions/core/CopyPasteProcessor.js +10 -0
- package/lib/extensions/core/NodeProcessor.js +1 -1
- package/lib/extensions/core/TextProcessor.js +11 -24
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +4 -7
- package/lib/extensions/core/__tests__/SelectionProcessor.test.js +4 -7
- package/lib/extensions/core/__tests__/TextProcessor.test.js +139 -14
- package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +26 -0
- package/lib/extensions/core/index.js +11 -2
- package/lib/extensions/core/plugins/PastePlugin.js +57 -0
- package/lib/extensions/core/plugins/ProseMirrorPlugin.js +20 -0
- package/lib/extensions/core/plugins/index.js +1 -0
- package/lib/extensions/index.js +46 -34
- package/lib/extensions/list/List.js +5 -4
- package/lib/extensions/list/__tests__/List.test.js +6 -10
- package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +60 -20
- package/lib/index.js +3 -0
- package/lib/injectionTokens.js +3 -1
- package/lib/services/ContentNormalizer.js +144 -28
- package/lib/services/ContextWidnow.js +23 -0
- package/lib/{__tests__/utils → services}/NodeFactory.js +5 -1
- package/lib/services/__tests__/ContentNormalizer.test.js +124 -8
- package/lib/services/__tests__/FavoriteColors.test.js +1 -1
- package/lib/services/index.js +2 -0
- package/lib/styles/content.css +108 -13
- package/lib/styles/helpers/offsets.css +16 -0
- package/lib/styles/variables.css +6 -0
- package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +4 -4
- package/lib/utils/__tests__/convertAlignment.test.js +16 -0
- package/lib/utils/__tests__/convertFontSize.test.js +21 -0
- package/lib/utils/__tests__/convertLineHeight.test.js +21 -0
- package/lib/utils/convertAlignment.js +12 -0
- package/lib/utils/convertColor.js +1 -1
- package/lib/utils/convertFontSize.js +8 -0
- package/lib/utils/convertLineHeight.js +17 -0
- package/lib/utils/importIcon.js +7 -6
- package/lib/utils/index.js +4 -0
- package/lib/utils/isWysiwygContent.js +12 -0
- package/lib/utils/renderInlineSetting.js +1 -1
- package/package.json +26 -30
- package/config/webpack/example.config.js +0 -88
- package/config/webpack/lib.config.js +0 -44
- package/config/webpack/loaders/index.js +0 -6
- package/config/webpack/loaders/js-loader.js +0 -5
- package/config/webpack/loaders/style-loader.js +0 -9
- package/config/webpack/loaders/svg-loader.js +0 -4
- package/config/webpack/loaders/vue-loader.js +0 -4
- package/dist/wysiwyg.js +0 -2
- package/dist/wysiwyg.js.LICENSE.txt +0 -1
- package/lib/extensions/core/inputRules/closeDoubleQuote.js +0 -6
- package/lib/extensions/core/inputRules/closeSingleQuote.js +0 -6
- package/lib/extensions/core/inputRules/copyright.js +0 -6
- package/lib/extensions/core/inputRules/ellipsis.js +0 -6
- package/lib/extensions/core/inputRules/emDash.js +0 -6
- package/lib/extensions/core/inputRules/index.js +0 -9
- package/lib/extensions/core/inputRules/openDoubleQuote.js +0 -6
- package/lib/extensions/core/inputRules/openSingleQuote.js +0 -6
- package/lib/extensions/core/inputRules/registeredTrademark.js +0 -6
- package/lib/extensions/core/inputRules/trademark.js +0 -6
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import { provide } from '
|
|
27
|
+
import { provide } from 'vue';
|
|
28
28
|
import ScrollView from '../ScrollView';
|
|
29
29
|
import { InjectionTokens } from './injectionTokens';
|
|
30
30
|
import DropdownGroup from './DropdownGroup';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
import { computed, inject, nextTick, onMounted, ref, toRef } from '
|
|
13
|
+
import { computed, inject, nextTick, onMounted, ref, toRef } from 'vue';
|
|
14
14
|
import Button from '../Button';
|
|
15
15
|
import { useScrollView } from '../composables';
|
|
16
16
|
import { InjectionTokens } from './injectionTokens';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { ref } from '
|
|
2
|
+
import { ref } from 'vue';
|
|
3
3
|
import DropdownActivator from '../DropdownActivator';
|
|
4
4
|
import { InjectionTokens } from '../injectionTokens';
|
|
5
5
|
import Button from '../../Button';
|
|
@@ -6,6 +6,8 @@ export { default as FieldLabel } from './FieldLabel';
|
|
|
6
6
|
export { default as Range } from './Range';
|
|
7
7
|
export { default as NumberField } from './NumberField';
|
|
8
8
|
export { default as Modal } from './Modal';
|
|
9
|
-
export {
|
|
9
|
+
export { default as TextField } from './TextField';
|
|
10
|
+
export { default as Checkbox } from './Checkbox';
|
|
11
|
+
export { useModalToggler, useElementRef } from './composables';
|
|
10
12
|
export * from './dropdown';
|
|
11
13
|
export * from './colorPicker';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<keep-alive>
|
|
3
|
+
<transition name="zw-toolbar-" duration="150">
|
|
4
|
+
<div class="zw-toolbar" :style="toolbarStyles" ref="toolbarRef" v-if="isVisible">
|
|
5
|
+
<component :is="toolbarComponent" />
|
|
6
|
+
</div>
|
|
7
|
+
</transition>
|
|
8
|
+
</keep-alive>
|
|
7
9
|
</template>
|
|
8
10
|
|
|
9
11
|
<script>
|
|
10
|
-
import { computed } from '
|
|
12
|
+
import { computed, ref, watch } from 'vue';
|
|
11
13
|
import { Devices } from '../../enums';
|
|
12
14
|
import ToolbarFull from './ToolbarFull';
|
|
13
15
|
import ToolbarDevice from './ToolbarDevice';
|
|
@@ -19,6 +21,11 @@ export default {
|
|
|
19
21
|
device: {
|
|
20
22
|
type: String,
|
|
21
23
|
required: true
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
toolbar: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true
|
|
22
29
|
}
|
|
23
30
|
},
|
|
24
31
|
|
|
@@ -26,8 +33,23 @@ export default {
|
|
|
26
33
|
const toolbarComponent = computed(() => {
|
|
27
34
|
return props.device === Devices.DESKTOP ? ToolbarFull : ToolbarDevice;
|
|
28
35
|
});
|
|
36
|
+
const isVisible = computed(() => props.toolbar.isActiveRef.value);
|
|
37
|
+
const toolbarRef = ref(null);
|
|
38
|
+
|
|
39
|
+
watch(toolbarRef, (toolbarEl) => {
|
|
40
|
+
toolbarEl && props.toolbar.mount(toolbarEl);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const toolbarStyles = computed(() => ({
|
|
44
|
+
'--zw-toolbar-offset-y': `${props.toolbar.offsets[1]}px`
|
|
45
|
+
}));
|
|
29
46
|
|
|
30
|
-
return {
|
|
47
|
+
return {
|
|
48
|
+
toolbarComponent,
|
|
49
|
+
isVisible,
|
|
50
|
+
toolbarRef,
|
|
51
|
+
toolbarStyles
|
|
52
|
+
};
|
|
31
53
|
}
|
|
32
54
|
};
|
|
33
55
|
</script>
|
|
@@ -37,12 +59,32 @@ export default {
|
|
|
37
59
|
border-radius: 2px;
|
|
38
60
|
background-color: rgb(var(--zw-color-n15));
|
|
39
61
|
color: rgb(var(--zw-color-n70));
|
|
40
|
-
z-index:
|
|
62
|
+
z-index: 999999;
|
|
63
|
+
text-align: left;
|
|
64
|
+
position: absolute;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.zw-toolbar::before,
|
|
68
|
+
.zw-toolbar::after {
|
|
69
|
+
content: "";
|
|
70
|
+
display: block;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: calc(var(--zw-toolbar-offset-y) + 4px);
|
|
73
|
+
position: absolute;
|
|
74
|
+
--zw-toolbar-safe-zone: calc(-1 * var(--zw-toolbar-offset-y));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.zw-toolbar::before {
|
|
78
|
+
top: var(--zw-toolbar-safe-zone);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.zw-toolbar::after {
|
|
82
|
+
bottom: var(--zw-toolbar-safe-zone);
|
|
41
83
|
}
|
|
42
84
|
|
|
43
85
|
.zw-toolbar--enter-active,
|
|
44
86
|
.zw-toolbar--leave-active {
|
|
45
|
-
transition: opacity
|
|
87
|
+
transition: opacity 150ms ease-out;
|
|
46
88
|
}
|
|
47
89
|
|
|
48
90
|
.zw-toolbar--leave-active {
|
|
@@ -14,31 +14,52 @@
|
|
|
14
14
|
<FontColorControl />
|
|
15
15
|
<BackgroundColorControl />
|
|
16
16
|
</ToolbarGroup>
|
|
17
|
+
|
|
18
|
+
<template v-if="isPopupMode">
|
|
19
|
+
<ToolbarDivider vertical />
|
|
20
|
+
|
|
21
|
+
<ToolbarGroup>
|
|
22
|
+
<ItalicControl />
|
|
23
|
+
<UnderlineControl />
|
|
24
|
+
<StrikeThroughControl />
|
|
25
|
+
<SuperscriptControl />
|
|
26
|
+
<CaseStyleControl />
|
|
27
|
+
</ToolbarGroup>
|
|
28
|
+
</template>
|
|
17
29
|
</ToolbarRow>
|
|
18
30
|
|
|
19
31
|
<ToolbarDivider horizontal />
|
|
20
32
|
|
|
21
33
|
<ToolbarRow>
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
<template v-if="!isPopupMode">
|
|
35
|
+
<ToolbarGroup>
|
|
36
|
+
<ItalicControl />
|
|
37
|
+
<UnderlineControl />
|
|
38
|
+
<StrikeThroughControl />
|
|
39
|
+
<SuperscriptControl />
|
|
40
|
+
<CaseStyleControl />
|
|
41
|
+
</ToolbarGroup>
|
|
42
|
+
|
|
43
|
+
<ToolbarDivider vertical />
|
|
44
|
+
</template>
|
|
29
45
|
|
|
30
|
-
<ToolbarDivider vertical />
|
|
31
46
|
<AlignmentControl />
|
|
32
47
|
<ToolbarDivider vertical />
|
|
33
48
|
|
|
34
49
|
<ToolbarGroup>
|
|
35
50
|
<LineHeightControl />
|
|
51
|
+
</ToolbarGroup>
|
|
52
|
+
|
|
53
|
+
<ToolbarDivider vertical />
|
|
54
|
+
|
|
55
|
+
<ToolbarGroup>
|
|
36
56
|
<ListControl />
|
|
37
57
|
</ToolbarGroup>
|
|
38
58
|
|
|
39
59
|
<ToolbarDivider vertical />
|
|
40
60
|
|
|
41
61
|
<ToolbarGroup>
|
|
62
|
+
<LinkControl />
|
|
42
63
|
<RemoveFormatControl />
|
|
43
64
|
</ToolbarGroup>
|
|
44
65
|
</ToolbarRow>
|
|
@@ -46,6 +67,8 @@
|
|
|
46
67
|
</template>
|
|
47
68
|
|
|
48
69
|
<script>
|
|
70
|
+
import { inject } from 'vue';
|
|
71
|
+
import { InjectionTokens } from '../../injectionTokens';
|
|
49
72
|
import ToolbarDivider from './ToolbarDivider';
|
|
50
73
|
import ToolbarRow from './ToolbarRow';
|
|
51
74
|
import ToolbarGroup from './ToolbarGroup';
|
|
@@ -64,7 +87,8 @@ import {
|
|
|
64
87
|
SuperscriptControl,
|
|
65
88
|
UnderlineControl,
|
|
66
89
|
ListControl,
|
|
67
|
-
RemoveFormatControl
|
|
90
|
+
RemoveFormatControl,
|
|
91
|
+
LinkControl
|
|
68
92
|
} from './controls';
|
|
69
93
|
|
|
70
94
|
export default {
|
|
@@ -88,7 +112,14 @@ export default {
|
|
|
88
112
|
AlignmentControl,
|
|
89
113
|
LineHeightControl,
|
|
90
114
|
ListControl,
|
|
91
|
-
RemoveFormatControl
|
|
115
|
+
RemoveFormatControl,
|
|
116
|
+
LinkControl
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
setup() {
|
|
120
|
+
const isPopupMode = inject(InjectionTokens.POPUP_MODE);
|
|
121
|
+
|
|
122
|
+
return { isPopupMode };
|
|
92
123
|
}
|
|
93
124
|
};
|
|
94
125
|
</script>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
2
3
|
import { Devices } from '../../../enums';
|
|
3
4
|
import Toolbar from '../Toolbar';
|
|
4
5
|
import ToolbarFull from '../ToolbarFull';
|
|
@@ -7,6 +8,11 @@ import ToolbarDevice from '../ToolbarDevice';
|
|
|
7
8
|
function createComponent({ device }) {
|
|
8
9
|
return shallowMount(Toolbar, {
|
|
9
10
|
propsData: {
|
|
11
|
+
toolbar: {
|
|
12
|
+
mount: jest.fn(),
|
|
13
|
+
isActiveRef: ref({ value: true }),
|
|
14
|
+
offsets: [0, 8]
|
|
15
|
+
},
|
|
10
16
|
device: device ?? Devices.DESKTOP
|
|
11
17
|
}
|
|
12
18
|
});
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script>
|
|
18
|
-
import { inject } from '
|
|
18
|
+
import { inject } from 'vue';
|
|
19
19
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
20
20
|
import { Alignments } from '../../../enums';
|
|
21
21
|
import { ButtonToggle, Button, Icon } from '../../base';
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
|
-
import { inject, ref } from '
|
|
20
|
+
import { inject, ref } from 'vue';
|
|
21
21
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
22
22
|
import { Button, Icon, Modal, useModalToggler } from '../../base';
|
|
23
23
|
import { tooltip } from '../../../directives';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script>
|
|
18
|
-
import { inject } from '
|
|
18
|
+
import { inject } from 'vue';
|
|
19
19
|
import { ColorPicker, Button, Icon } from '../../base';
|
|
20
20
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
21
21
|
import { tooltip } from '../../../directives';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
|
-
import { inject } from '
|
|
21
|
+
import { inject } from 'vue';
|
|
22
22
|
import { CaseStyles } from '../../../enums';
|
|
23
23
|
import { Dropdown, Button, Icon } from '../../base';
|
|
24
24
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script>
|
|
18
|
-
import { inject } from '
|
|
18
|
+
import { inject } from 'vue';
|
|
19
19
|
import { ColorPicker, Button, Icon } from '../../base';
|
|
20
20
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
21
21
|
import { tooltip } from '../../../directives';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
|
-
import { computed, inject } from '
|
|
21
|
+
import { computed, inject } from 'vue';
|
|
22
22
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
23
23
|
import { tooltip } from '../../../directives';
|
|
24
24
|
import { Dropdown, DropdownOption } from '../../base';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Dropdown
|
|
3
|
+
class="zw-font-size-control"
|
|
3
4
|
:options="options"
|
|
4
5
|
:value="currentValue"
|
|
5
6
|
@change="apply"
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
</template>
|
|
9
10
|
|
|
10
11
|
<script>
|
|
11
|
-
import { computed, inject } from '
|
|
12
|
+
import { computed, inject } from 'vue';
|
|
12
13
|
import { Dropdown } from '../../base';
|
|
13
14
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
14
15
|
import { tooltip } from '../../../directives';
|
|
@@ -43,3 +44,9 @@ export default {
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
</script>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.zw-font-size-control {
|
|
50
|
+
width: 64px;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
-
import { computed, inject } from '
|
|
11
|
+
import { computed, inject } from 'vue';
|
|
12
12
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
13
13
|
import { Dropdown } from '../../base';
|
|
14
14
|
import { tooltip } from '../../../directives';
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script>
|
|
15
|
-
import { inject } from '
|
|
15
|
+
import { inject } from 'vue';
|
|
16
16
|
import { Button, Icon } from '../../base';
|
|
17
17
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
18
18
|
import { tooltip } from '../../../directives';
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</template>
|
|
41
41
|
|
|
42
42
|
<script>
|
|
43
|
-
import { inject, ref } from '
|
|
43
|
+
import { inject, ref } from 'vue';
|
|
44
44
|
import { Button, Icon, Modal, Range, NumberField, FieldLabel, useModalToggler } from '../../base';
|
|
45
45
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
46
46
|
import { tooltip } from '../../../directives';
|
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
<div class="zpa-list-control">
|
|
3
|
+
<Button
|
|
4
|
+
icon
|
|
5
|
+
skin="toolbar"
|
|
6
|
+
:active="isCurrentListSelected"
|
|
7
|
+
@click="toggle"
|
|
8
|
+
v-tooltip="'Bullets'"
|
|
9
|
+
>
|
|
10
|
+
<Icon :name="currentIcon" size="28px" auto-color />
|
|
11
|
+
</Button>
|
|
12
|
+
|
|
13
|
+
<Dropdown
|
|
14
|
+
:value="currentValue"
|
|
15
|
+
:options="$options.listTypes"
|
|
16
|
+
@change="apply"
|
|
17
|
+
>
|
|
18
|
+
<template #activator="{ open, isOpened }">
|
|
19
|
+
<Button
|
|
20
|
+
icon
|
|
21
|
+
skin="toolbar"
|
|
22
|
+
:active="isOpened"
|
|
23
|
+
@click="open"
|
|
24
|
+
v-tooltip="'Bullet Styles'"
|
|
25
|
+
>
|
|
26
|
+
<Icon
|
|
27
|
+
class="zw-list-control__activator"
|
|
28
|
+
name="arrow"
|
|
29
|
+
size="8px"
|
|
30
|
+
auto-color
|
|
31
|
+
/>
|
|
32
|
+
</Button>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<template #option="{ option }">
|
|
36
|
+
<DropdownOption
|
|
37
|
+
class="zw-list-control__option"
|
|
38
|
+
:option="option"
|
|
39
|
+
>
|
|
40
|
+
<Icon :name="option.icon" size="28px" auto-color />
|
|
41
|
+
</DropdownOption>
|
|
42
|
+
</template>
|
|
43
|
+
</Dropdown>
|
|
44
|
+
</div>
|
|
29
45
|
</template>
|
|
30
46
|
|
|
31
47
|
<script>
|
|
32
|
-
import { computed, inject } from '
|
|
48
|
+
import { computed, inject, ref } from 'vue';
|
|
33
49
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
34
50
|
import { Dropdown, DropdownOption, Button, Icon } from '../../base';
|
|
35
51
|
import { ListTypes } from '../../../enums';
|
|
@@ -59,26 +75,44 @@ export default {
|
|
|
59
75
|
const selectionValue = editor.commands.getListType();
|
|
60
76
|
const isList = computed(() => !!selectionValue.value);
|
|
61
77
|
const currentValue = computed(() => selectionValue.value || 'none');
|
|
78
|
+
const recentListType = ref(ListTypes.DISC);
|
|
79
|
+
const isCurrentListSelected = computed(() => selectionValue.value === recentListType.value);
|
|
62
80
|
|
|
63
|
-
const currentIcon = computed(() => {
|
|
64
|
-
const type = selectionValue.value || ListTypes.DISC;
|
|
81
|
+
const currentIcon = computed(() => `list-${recentListType.value}`);
|
|
65
82
|
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
const apply = (type) => {
|
|
84
|
+
recentListType.value = type;
|
|
85
|
+
editor.chain().focus().applyList(type).run();
|
|
86
|
+
};
|
|
68
87
|
|
|
69
|
-
const
|
|
88
|
+
const toggle = () => apply(recentListType.value || ListTypes.DISC);
|
|
70
89
|
|
|
71
90
|
return {
|
|
72
91
|
isList,
|
|
73
92
|
currentValue,
|
|
74
93
|
currentIcon,
|
|
75
|
-
|
|
94
|
+
isCurrentListSelected,
|
|
95
|
+
apply,
|
|
96
|
+
toggle
|
|
76
97
|
};
|
|
77
98
|
}
|
|
78
99
|
};
|
|
79
100
|
</script>
|
|
80
101
|
|
|
81
102
|
<style scoped>
|
|
103
|
+
.zpa-list-control {
|
|
104
|
+
display: flex;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.zpa-list-control:hover {
|
|
108
|
+
color: rgb(var(--zw-color-white));
|
|
109
|
+
background-color: rgb(var(--zw-color-n5));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.zw-list-control__activator {
|
|
113
|
+
padding: 0 var(--zw-offset-xs);
|
|
114
|
+
}
|
|
115
|
+
|
|
82
116
|
.zw-list-control__option {
|
|
83
117
|
padding: 0 var(--zw-offset-xs);
|
|
84
118
|
display: flex;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
import { inject } from '
|
|
13
|
+
import { inject } from 'vue';
|
|
14
14
|
import { Button, Icon } from '../../base';
|
|
15
15
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
16
16
|
import { tooltip } from '../../../directives';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import { inject } from '
|
|
14
|
+
import { inject } from 'vue';
|
|
15
15
|
import { Button, Icon } from '../../base';
|
|
16
16
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
17
17
|
import { tooltip } from '../../../directives';
|
|
@@ -21,10 +21,13 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script>
|
|
24
|
-
import { computed, inject } from '
|
|
24
|
+
import { computed, inject } from 'vue';
|
|
25
25
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
26
26
|
import { Dropdown, Button, Icon } from '../../base';
|
|
27
27
|
import { tooltip } from '../../../directives';
|
|
28
|
+
import { TextSettings } from '../../../enums';
|
|
29
|
+
|
|
30
|
+
const CLEAR_MARKS = [TextSettings.FONT_SIZE, TextSettings.FONT_WEIGHT];
|
|
28
31
|
|
|
29
32
|
export default {
|
|
30
33
|
name: 'StylePresetControl',
|
|
@@ -59,7 +62,17 @@ export default {
|
|
|
59
62
|
}));
|
|
60
63
|
});
|
|
61
64
|
|
|
62
|
-
const apply = (value) =>
|
|
65
|
+
const apply = (value) => {
|
|
66
|
+
editor.chain()
|
|
67
|
+
.focus()
|
|
68
|
+
.applyPreset(value)
|
|
69
|
+
.storeSelection()
|
|
70
|
+
.expandSelectionToBlock()
|
|
71
|
+
.unsetMarks(CLEAR_MARKS)
|
|
72
|
+
.restoreSelection()
|
|
73
|
+
.run();
|
|
74
|
+
};
|
|
75
|
+
|
|
63
76
|
const removeCustomization = () => editor.chain().focus().removePresetCustomization().run();
|
|
64
77
|
|
|
65
78
|
return {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import { computed, inject } from '
|
|
14
|
+
import { computed, inject } from 'vue';
|
|
15
15
|
import { Button, Icon } from '../../base';
|
|
16
16
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
17
17
|
import { tooltip } from '../../../directives';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import { inject } from '
|
|
14
|
+
import { inject, computed } from 'vue';
|
|
15
15
|
import { Button, Icon } from '../../base';
|
|
16
16
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
17
17
|
import { tooltip } from '../../../directives';
|
|
@@ -31,7 +31,7 @@ export default {
|
|
|
31
31
|
setup() {
|
|
32
32
|
const editor = inject(InjectionTokens.EDITOR);
|
|
33
33
|
|
|
34
|
-
const currentValue = editor.commands.isUnderline();
|
|
34
|
+
const currentValue = computed(() => editor.commands.isUnderline().value);
|
|
35
35
|
const apply = () => editor.chain().focus().toggleUnderline().run();
|
|
36
36
|
|
|
37
37
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { h, ref } from '
|
|
2
|
+
import { h, ref } from 'vue';
|
|
3
3
|
import { InjectionTokens } from '../../../../injectionTokens';
|
|
4
4
|
import { Alignments } from '../../../../enums';
|
|
5
5
|
import { ButtonToggle } from '../../../base';
|