sprintify-ui 0.11.34 → 0.12.1

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.
@@ -1,170 +0,0 @@
1
- <template>
2
- <ckeditor
3
- :model-value="modelValueInternal"
4
- :editor="editorInternal"
5
- :config="config"
6
- :disabled="disabled"
7
- @update:model-value="emit('update:modelValue', $event)"
8
- @focus="emit('focus', $event)"
9
- @blur="emit('blur', $event)"
10
- @input="emit('input', $event)"
11
- @ready="onReady"
12
- />
13
- </template>
14
-
15
- <script lang="ts" setup>
16
- import { ClassicEditor, InlineEditor, BalloonEditor, Essentials, SourceEditing, MediaEmbed, Paragraph, Bold, Italic, Strikethrough, Subscript, Superscript, List, Link, Autoformat, Heading, Underline, Code, CodeBlock, Indent, IndentBlock, Table, TableToolbar, Image, ImageResize, ImageStyle, ImageToolbar, ImageInsert, AutoImage, Base64UploadAdapter, PasteFromOffice, BlockToolbar, Font, FindAndReplace, RemoveFormat } from 'ckeditor5';
17
- import { Ckeditor } from '@ckeditor/ckeditor5-vue';
18
- import { Size } from '@/utils/sizes';
19
- import { ToolbarOption } from '@/types/ToolbarOption';
20
-
21
- const props = withDefaults(defineProps<{
22
- modelValue: string | null | undefined;
23
- editor?: 'classic' | 'inline' | 'balloon';
24
- size?: Size;
25
- toolbar?: ToolbarOption[] | string[];
26
- placeholder?: string;
27
- disabled?: boolean;
28
- }>(), {
29
- editor: 'classic',
30
- size: 'md',
31
- toolbar() {
32
- return [
33
- 'undo',
34
- 'redo',
35
- '|',
36
- 'heading',
37
- 'bold',
38
- 'italic',
39
- 'underline',
40
- 'fontBackgroundColor',
41
- '|',
42
- 'link',
43
- 'insertImage',
44
- '|',
45
- 'numberedList',
46
- 'bulletedList',
47
- '|',
48
- 'insertTable'
49
- ] as ToolbarOption[];
50
- },
51
- placeholder: '',
52
- disabled: false,
53
- hasError: false,
54
- });
55
-
56
- const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'input', 'ready']);
57
-
58
- type Editor = InlineEditor | BalloonEditor | ClassicEditor;
59
-
60
- let ckeditorInstance = null as Editor | null;
61
-
62
- function onReady(editor: Editor | null) {
63
- ckeditorInstance = editor;
64
- emit('ready', editor);
65
- }
66
-
67
- const editorInternal = computed(() => {
68
- switch (props.editor) {
69
- case 'inline':
70
- return InlineEditor;
71
- case 'balloon':
72
- return BalloonEditor;
73
- default:
74
- return ClassicEditor;
75
- }
76
- });
77
-
78
- const modelValueInternal = computed(() => {
79
- if (props.modelValue === null) {
80
- return '';
81
- }
82
-
83
- return props.modelValue;
84
- });
85
-
86
- const config = computed(() => {
87
- return {
88
- licenseKey: 'GPL',
89
- plugins: [
90
- Essentials,
91
- SourceEditing,
92
- Paragraph,
93
- Bold,
94
- Italic,
95
- Underline,
96
- Strikethrough,
97
- Subscript,
98
- Superscript,
99
- Code,
100
- CodeBlock,
101
- List,
102
- Indent,
103
- IndentBlock,
104
- Link,
105
- Autoformat,
106
- Heading,
107
- Image,
108
- AutoImage,
109
- ImageStyle,
110
- ImageResize,
111
- ImageToolbar,
112
- ImageInsert,
113
- Base64UploadAdapter,
114
- Table,
115
- TableToolbar,
116
- MediaEmbed,
117
- PasteFromOffice,
118
- BlockToolbar,
119
- Font,
120
- FindAndReplace,
121
- RemoveFormat,
122
- ],
123
- toolbar: {
124
- items: props.toolbar,
125
- shouldNotGroupWhenFull: true,
126
- },
127
- table: {
128
- contentToolbar: ['tableColumn', 'tableRow']
129
- },
130
- image: {
131
- resizeOptions: [
132
- {
133
- name: 'resizeImage:original',
134
- label: 'Default image width',
135
- value: null
136
- },
137
- {
138
- name: 'resizeImage:50',
139
- label: '50% page width',
140
- value: '50'
141
- },
142
- {
143
- name: 'resizeImage:75',
144
- label: '75% page width',
145
- value: '75'
146
- },
147
- {
148
- name: 'resizeImage:100',
149
- label: '100% page width',
150
- value: '100'
151
- }
152
- ],
153
- toolbar: [
154
- 'imageStyle:alignBlockLeft',
155
- 'imageStyle:block',
156
- 'imageStyle:alignBlockRight',
157
- 'resizeImage'
158
- ]
159
- },
160
- placeholder: props.placeholder,
161
- };
162
- });
163
-
164
- defineExpose({
165
- getEditorData() {
166
- return ckeditorInstance?.getData() || '';
167
- },
168
- });
169
-
170
- </script>