@zipify/wysiwyg 4.11.1 → 4.11.3

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.
@@ -10,6 +10,7 @@ export declare class Font {
10
10
  weights: string[];
11
11
  constructor({ name, category, styles }: IFontJson);
12
12
  private getWeights;
13
+ get isItalicOnly(): boolean;
13
14
  isWeightSupported(weight: string): boolean;
14
15
  isItalicSupported(weight: string): boolean;
15
16
  isWeightItalicOnly(weight: string): boolean;
package/dist/wysiwyg.mjs CHANGED
@@ -23530,7 +23530,9 @@ const FontFamily = Mark2.create({
23530
23530
  commands2.applyFontWeight(fontWeight);
23531
23531
  }
23532
23532
  const isItalicCustomized = commands2.isSettingCustomized(TextSetting.FONT_STYLE).value;
23533
- if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
23533
+ if (font.isItalicOnly) {
23534
+ commands2.applyItalic();
23535
+ } else if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
23534
23536
  commands2.removeItalic();
23535
23537
  }
23536
23538
  }),
@@ -28619,7 +28621,7 @@ const _sfc_main$r = {
28619
28621
  const favoriteColors = computed(() => unref(favoriteColorsService.listRef));
28620
28622
  const updateFavoriteColors = (colors) => favoriteColorsService.triggerUpdate(colors);
28621
28623
  return (_ctx, _cache) => {
28622
- return withDirectives((openBlock(), createBlock(unref(ColorPicker), {
28624
+ return openBlock(), createBlock(unref(ColorPicker), {
28623
28625
  ref_key: "pickerRef",
28624
28626
  ref: pickerRef,
28625
28627
  placement: "bottom-end",
@@ -28628,8 +28630,9 @@ const _sfc_main$r = {
28628
28630
  window: unref(ContextWindow).window,
28629
28631
  "model-value": unref(api).editingColor,
28630
28632
  "has-gradient": false,
28631
- onChangeFavoriteColors: updateFavoriteColors,
28632
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(api).editingColor = $event)
28633
+ "onUpdate:favoriteColors": updateFavoriteColors,
28634
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(api).editingColor = $event),
28635
+ onOutsideClick: unref(api).close
28633
28636
  }, {
28634
28637
  activator: withCtx(() => [
28635
28638
  renderSlot(_ctx.$slots, "activator", {
@@ -28640,9 +28643,7 @@ const _sfc_main$r = {
28640
28643
  })
28641
28644
  ]),
28642
28645
  _: 3
28643
- }, 8, ["favorite-colors", "window", "model-value"])), [
28644
- [unref(outClick), { onOutClick: unref(api).close, isDisabled: !unref(api).isOpened }]
28645
- ]);
28646
+ }, 8, ["favorite-colors", "window", "model-value", "onOutsideClick"]);
28646
28647
  };
28647
28648
  }
28648
28649
  };
@@ -30230,6 +30231,9 @@ class Font {
30230
30231
  const weights = this.styles.map((style2) => style2.replace("i", ""));
30231
30232
  return Array.from(new Set(weights));
30232
30233
  }
30234
+ get isItalicOnly() {
30235
+ return this.styles.every((style2) => style2.endsWith("i"));
30236
+ }
30233
30237
  isWeightSupported(weight) {
30234
30238
  return this.weights.includes(weight);
30235
30239
  }
package/example/fonts.js CHANGED
@@ -1,35 +1,35 @@
1
1
  export const FONTS = [
2
2
  {
3
- 'name': 'Merriweather',
4
- 'styles': [
3
+ name: 'Merriweather',
4
+ styles: [
5
5
  '900i'
6
6
  ],
7
- 'category': 'Serif'
7
+ category: 'Serif'
8
8
  },
9
9
  {
10
- 'name': 'Arvo',
11
- 'styles': [
10
+ name: 'Arvo',
11
+ styles: [
12
12
  '400',
13
13
  '400i',
14
14
  '700',
15
15
  '700i'
16
16
  ],
17
- 'category': 'Serif'
17
+ category: 'Serif'
18
18
  },
19
19
  {
20
- 'name': 'BioRhyme',
21
- 'styles': [
20
+ name: 'BioRhyme',
21
+ styles: [
22
22
  '200',
23
23
  '300',
24
24
  '400',
25
25
  '700',
26
26
  '800'
27
27
  ],
28
- 'category': 'Serif'
28
+ category: 'Serif'
29
29
  },
30
30
  {
31
- 'name': 'Josefin Slab',
32
- 'styles': [
31
+ name: 'Josefin Slab',
32
+ styles: [
33
33
  '100',
34
34
  '100i',
35
35
  '300',
@@ -41,11 +41,11 @@ export const FONTS = [
41
41
  '700',
42
42
  '700i'
43
43
  ],
44
- 'category': 'Serif'
44
+ category: 'Serif'
45
45
  },
46
46
  {
47
- 'name': 'Rubik',
48
- 'styles': [
47
+ name: 'Rubik',
48
+ styles: [
49
49
  '300',
50
50
  '300i',
51
51
  '400',
@@ -57,11 +57,11 @@ export const FONTS = [
57
57
  '900',
58
58
  '900i'
59
59
  ],
60
- 'category': 'Serif'
60
+ category: 'Serif'
61
61
  },
62
62
  {
63
- 'name': 'Alegreya',
64
- 'styles': [
63
+ name: 'Alegreya',
64
+ styles: [
65
65
  '400',
66
66
  '400i',
67
67
  '500',
@@ -73,11 +73,11 @@ export const FONTS = [
73
73
  '900',
74
74
  '900i'
75
75
  ],
76
- 'category': 'Serif'
76
+ category: 'Serif'
77
77
  },
78
78
  {
79
- 'name': 'Crimson Text',
80
- 'styles': [
79
+ name: 'Crimson Text',
80
+ styles: [
81
81
  '400',
82
82
  '400i',
83
83
  '600',
@@ -85,58 +85,58 @@ export const FONTS = [
85
85
  '700',
86
86
  '700i'
87
87
  ],
88
- 'category': 'Serif'
88
+ category: 'Serif'
89
89
  },
90
90
  {
91
- 'name': 'PT Serif',
92
- 'styles': [
91
+ name: 'PT Serif',
92
+ styles: [
93
93
  '400',
94
94
  '400i',
95
95
  '700',
96
96
  '700i'
97
97
  ],
98
- 'category': 'Serif'
98
+ category: 'Serif'
99
99
  },
100
100
  {
101
- 'name': 'Anonymous Pro',
102
- 'styles': [
101
+ name: 'Anonymous Pro',
102
+ styles: [
103
103
  '400',
104
104
  '400i',
105
105
  '700',
106
106
  '700i'
107
107
  ],
108
- 'category': 'Serif'
108
+ category: 'Serif'
109
109
  },
110
110
  {
111
- 'name': 'Roboto Slab',
112
- 'styles': [
111
+ name: 'Roboto Slab',
112
+ styles: [
113
113
  '100',
114
114
  '300',
115
115
  '400',
116
116
  '700'
117
117
  ],
118
- 'category': 'Serif'
118
+ category: 'Serif'
119
119
  },
120
120
  {
121
- 'name': 'Scope One',
122
- 'styles': [
121
+ name: 'Scope One',
122
+ styles: [
123
123
  '400'
124
124
  ],
125
- 'category': 'Serif'
125
+ category: 'Serif'
126
126
  },
127
127
  {
128
- 'name': 'Droid Serif',
129
- 'styles': [
128
+ name: 'Droid Serif',
129
+ styles: [
130
130
  '400',
131
131
  '400i',
132
132
  '700',
133
133
  '700i'
134
134
  ],
135
- 'category': 'Serif'
135
+ category: 'Serif'
136
136
  },
137
137
  {
138
- 'name': 'Josefin Sans',
139
- 'styles': [
138
+ name: 'Josefin Sans',
139
+ styles: [
140
140
  '100',
141
141
  '100i',
142
142
  '300',
@@ -148,11 +148,11 @@ export const FONTS = [
148
148
  '700',
149
149
  '700i'
150
150
  ],
151
- 'category': 'Sans Serif'
151
+ category: 'Sans Serif'
152
152
  },
153
153
  {
154
- 'name': 'Work Sans',
155
- 'styles': [
154
+ name: 'Work Sans',
155
+ styles: [
156
156
  '100',
157
157
  '200',
158
158
  '300',
@@ -163,11 +163,11 @@ export const FONTS = [
163
163
  '800',
164
164
  '900'
165
165
  ],
166
- 'category': 'Sans Serif'
166
+ category: 'Sans Serif'
167
167
  },
168
168
  {
169
- 'name': 'Fira Sans',
170
- 'styles': [
169
+ name: 'Fira Sans',
170
+ styles: [
171
171
  '100',
172
172
  '100i',
173
173
  '200',
@@ -187,11 +187,11 @@ export const FONTS = [
187
187
  '900',
188
188
  '900i'
189
189
  ],
190
- 'category': 'Sans Serif'
190
+ category: 'Sans Serif'
191
191
  },
192
192
  {
193
- 'name': 'Alegreya Sans',
194
- 'styles': [
193
+ name: 'Alegreya Sans',
194
+ styles: [
195
195
  '100',
196
196
  '100i',
197
197
  '300',
@@ -207,11 +207,11 @@ export const FONTS = [
207
207
  '900',
208
208
  '900i'
209
209
  ],
210
- 'category': 'Sans Serif'
210
+ category: 'Sans Serif'
211
211
  },
212
212
  {
213
- 'name': 'Source Sans Pro',
214
- 'styles': [
213
+ name: 'Source Sans Pro',
214
+ styles: [
215
215
  '200',
216
216
  '200i',
217
217
  '300',
@@ -225,22 +225,22 @@ export const FONTS = [
225
225
  '900',
226
226
  '900i'
227
227
  ],
228
- 'category': 'Sans Serif'
228
+ category: 'Sans Serif'
229
229
  },
230
230
  {
231
- 'name': 'Rajdhani',
232
- 'styles': [
231
+ name: 'Rajdhani',
232
+ styles: [
233
233
  '300',
234
234
  '400',
235
235
  '500',
236
236
  '600',
237
237
  '700'
238
238
  ],
239
- 'category': 'Sans Serif'
239
+ category: 'Sans Serif'
240
240
  },
241
241
  {
242
- 'name': 'Ubuntu',
243
- 'styles': [
242
+ name: 'Ubuntu',
243
+ styles: [
244
244
  '300',
245
245
  '300i',
246
246
  '400',
@@ -250,11 +250,11 @@ export const FONTS = [
250
250
  '700',
251
251
  '700i'
252
252
  ],
253
- 'category': 'Sans Serif'
253
+ category: 'Sans Serif'
254
254
  },
255
255
  {
256
- 'name': 'Dosis',
257
- 'styles': [
256
+ name: 'Dosis',
257
+ styles: [
258
258
  '200',
259
259
  '300',
260
260
  '400',
@@ -263,19 +263,19 @@ export const FONTS = [
263
263
  '700',
264
264
  '800'
265
265
  ],
266
- 'category': 'Sans Serif'
266
+ category: 'Sans Serif'
267
267
  },
268
268
  {
269
- 'name': 'PT Sans Narrow',
270
- 'styles': [
269
+ name: 'PT Sans Narrow',
270
+ styles: [
271
271
  '400',
272
272
  '700'
273
273
  ],
274
- 'category': 'Sans Serif'
274
+ category: 'Sans Serif'
275
275
  },
276
276
  {
277
- 'name': 'Raleway',
278
- 'styles': [
277
+ name: 'Raleway',
278
+ styles: [
279
279
  '100',
280
280
  '100i',
281
281
  '200',
@@ -295,11 +295,11 @@ export const FONTS = [
295
295
  '900',
296
296
  '900i'
297
297
  ],
298
- 'category': 'Sans Serif'
298
+ category: 'Sans Serif'
299
299
  },
300
300
  {
301
- 'name': 'Lato',
302
- 'styles': [
301
+ name: 'Lato',
302
+ styles: [
303
303
  '100',
304
304
  '100i',
305
305
  '300',
@@ -311,11 +311,11 @@ export const FONTS = [
311
311
  '900',
312
312
  '900i'
313
313
  ],
314
- 'category': 'Sans Serif'
314
+ category: 'Sans Serif'
315
315
  },
316
316
  {
317
- 'name': 'Open Sans',
318
- 'styles': [
317
+ name: 'Open Sans',
318
+ styles: [
319
319
  '300',
320
320
  '300i',
321
321
  '400',
@@ -327,94 +327,94 @@ export const FONTS = [
327
327
  '800',
328
328
  '800i'
329
329
  ],
330
- 'category': 'Sans Serif'
330
+ category: 'Sans Serif'
331
331
  },
332
332
  {
333
- 'name': 'Bungee',
334
- 'styles': [
333
+ name: 'Bungee',
334
+ styles: [
335
335
  '400'
336
336
  ],
337
- 'category': 'Headings / Display'
337
+ category: 'Headings / Display'
338
338
  },
339
339
  {
340
- 'name': 'Abril Fatface',
341
- 'styles': [
340
+ name: 'Abril Fatface',
341
+ styles: [
342
342
  '400'
343
343
  ],
344
- 'category': 'Headings / Display'
344
+ category: 'Headings / Display'
345
345
  },
346
346
  {
347
- 'name': 'Ultra',
348
- 'styles': [
347
+ name: 'Ultra',
348
+ styles: [
349
349
  '400'
350
350
  ],
351
- 'category': 'Headings / Display'
351
+ category: 'Headings / Display'
352
352
  },
353
353
  {
354
- 'name': 'Lobster Two',
355
- 'styles': [
354
+ name: 'Lobster Two',
355
+ styles: [
356
356
  '400',
357
357
  '400i',
358
358
  '700',
359
359
  '700i'
360
360
  ],
361
- 'category': 'Headings / Display'
361
+ category: 'Headings / Display'
362
362
  },
363
363
  {
364
- 'name': 'Dancing Script',
365
- 'styles': [
364
+ name: 'Dancing Script',
365
+ styles: [
366
366
  '400',
367
367
  '700'
368
368
  ],
369
- 'category': 'Headings / Display'
369
+ category: 'Headings / Display'
370
370
  },
371
371
  {
372
- 'name': 'Caveat',
373
- 'styles': [
372
+ name: 'Caveat',
373
+ styles: [
374
374
  '400',
375
375
  '700'
376
376
  ],
377
- 'category': 'Headings / Display'
377
+ category: 'Headings / Display'
378
378
  },
379
379
  {
380
- 'name': 'Reenie Beanie',
381
- 'styles': [
380
+ name: 'Reenie Beanie',
381
+ styles: [
382
382
  '400'
383
383
  ],
384
- 'category': 'Headings / Display'
384
+ category: 'Headings / Display'
385
385
  },
386
386
  {
387
- 'name': 'Amatica SC',
388
- 'styles': [
387
+ name: 'Amatica SC',
388
+ styles: [
389
389
  '400',
390
390
  '700'
391
391
  ],
392
- 'category': 'Headings / Display'
392
+ category: 'Headings / Display'
393
393
  },
394
394
  {
395
- 'name': 'Kaushan Script',
396
- 'styles': [
395
+ name: 'Kaushan Script',
396
+ styles: [
397
397
  '400'
398
398
  ],
399
- 'category': 'Headings / Display'
399
+ category: 'Headings / Display'
400
400
  },
401
401
  {
402
- 'name': 'Just Another Hand',
403
- 'styles': [
402
+ name: 'Just Another Hand',
403
+ styles: [
404
404
  '400'
405
405
  ],
406
- 'category': 'Headings / Display'
406
+ category: 'Headings / Display'
407
407
  },
408
408
  {
409
- 'name': 'Poiret One',
410
- 'styles': [
409
+ name: 'Poiret One',
410
+ styles: [
411
411
  '400'
412
412
  ],
413
- 'category': 'Headings / Display'
413
+ category: 'Headings / Display'
414
414
  },
415
415
  {
416
- 'name': 'Montserrat',
417
- 'styles': [
416
+ name: 'Montserrat',
417
+ styles: [
418
418
  '100',
419
419
  '100i',
420
420
  '200',
@@ -434,11 +434,11 @@ export const FONTS = [
434
434
  '900',
435
435
  '900i'
436
436
  ],
437
- 'category': 'Regular'
437
+ category: 'Regular'
438
438
  },
439
439
  {
440
- 'name': 'Roboto',
441
- 'styles': [
440
+ name: 'Roboto',
441
+ styles: [
442
442
  '100',
443
443
  '100i',
444
444
  '300',
@@ -452,7 +452,7 @@ export const FONTS = [
452
452
  '900',
453
453
  '900i'
454
454
  ],
455
- 'category': 'Regular'
455
+ category: 'Regular'
456
456
  }
457
457
  ];
458
458
 
@@ -7,9 +7,9 @@
7
7
  :window="ContextWindow.window"
8
8
  :model-value="api.editingColor"
9
9
  :has-gradient="false"
10
- @change-favorite-colors="updateFavoriteColors"
10
+ @update:favorite-colors="updateFavoriteColors"
11
11
  @update:model-value="api.editingColor = $event"
12
- v-out-click="{ onOutClick: api.close, isDisabled: !api.isOpened }"
12
+ @outside-click="api.close"
13
13
  >
14
14
  <template #activator>
15
15
  <slot
@@ -26,7 +26,6 @@
26
26
  <script setup>
27
27
  import { ColorPicker } from '@zipify/colorpicker';
28
28
  import { computed, inject, ref, toRef, unref } from 'vue';
29
- import { outClick as vOutClick } from '../../../directives';
30
29
  import { InjectionTokens } from '../../../injectionTokens';
31
30
  import { ContextWindow } from '../../../services';
32
31
  import { usePickerApi, usePickerHotkeys } from './composables';
@@ -30,7 +30,9 @@ export const FontFamily = Mark.create({
30
30
 
31
31
  const isItalicCustomized = commands.isSettingCustomized(TextSetting.FONT_STYLE).value;
32
32
 
33
- if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
33
+ if (font.isItalicOnly) {
34
+ commands.applyItalic();
35
+ } else if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
34
36
  commands.removeItalic();
35
37
  }
36
38
  }),
@@ -23,6 +23,10 @@ export class Font {
23
23
  return Array.from(new Set(weights));
24
24
  }
25
25
 
26
+ get isItalicOnly(): boolean {
27
+ return this.styles.every((style) => style.endsWith('i'));
28
+ }
29
+
26
30
  isWeightSupported(weight: string): boolean {
27
31
  return this.weights.includes(weight);
28
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "4.11.1",
3
+ "version": "4.11.3",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "types": "dist/wysiwyg.d.ts",