@tekkare/romulus 0.1.333 → 0.1.334

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.332",
7
+ "version": "0.1.333",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -3,7 +3,9 @@
3
3
 
4
4
  A ne pas confondre avec RmNoteEditor, qui redige les notes a blocs types du
5
5
  panneau « Notes ». Celui-ci produit un document libre : le JSON de Tiptap
6
- (`v-model`), que l'appelant enregistre tel quel.
6
+ (`v-model`), que l'appelant enregistre tel quel. Avec `output="html"`, le
7
+ `v-model` est du HTML : en entree comme en sortie (les news du portail
8
+ stockent leur description en HTML).
7
9
 
8
10
  Ce qu'il sait faire :
9
11
  - gras, italique, souligne, barre, code, liens ;
@@ -57,7 +59,9 @@ import {
57
59
 
58
60
  const props = withDefaults(
59
61
  defineProps<{
60
- modelValue?: Record<string, unknown> | null
62
+ modelValue?: Record<string, unknown> | string | null
63
+ /** Format du `v-model` : le JSON de Tiptap, ou du HTML. */
64
+ output?: 'json' | 'html'
61
65
  editable?: boolean
62
66
  placeholder?: string
63
67
  /** Les membres que `@` peut citer. Vide : pas de mention de personne. */
@@ -78,6 +82,7 @@ const props = withDefaults(
78
82
  }>(),
79
83
  {
80
84
  modelValue: null,
85
+ output: 'json',
81
86
  editable: true,
82
87
  placeholder: 'Écrivez, ou tapez « / » pour insérer un bloc, « @ » pour citer…',
83
88
  members: () => [],
@@ -90,7 +95,7 @@ const props = withDefaults(
90
95
  )
91
96
 
92
97
  const emit = defineEmits<{
93
- 'update:modelValue': [value: Record<string, unknown>]
98
+ 'update:modelValue': [value: Record<string, unknown> | string]
94
99
  'open-page': [id: string]
95
100
  'open-member': [id: string]
96
101
  'open-resource': [resource: { id: string; resourceType: string }]
@@ -369,9 +374,9 @@ const editor = useEditor({
369
374
  RichCommands,
370
375
  ],
371
376
  onUpdate: ({ editor: e }) => {
372
- const json = e.getJSON()
373
- lastEmitted = JSON.stringify(json)
374
- emit('update:modelValue', json)
377
+ const value = props.output === 'html' ? e.getHTML() : e.getJSON()
378
+ lastEmitted = JSON.stringify(value)
379
+ emit('update:modelValue', value)
375
380
  },
376
381
  })
377
382
 
@@ -383,7 +388,8 @@ watch(
383
388
  const e = editor.value
384
389
  if (!e) return
385
390
  const next = JSON.stringify(value ?? null)
386
- if (next === lastEmitted || next === JSON.stringify(e.getJSON())) return
391
+ const current = props.output === 'html' ? e.getHTML() : e.getJSON()
392
+ if (next === lastEmitted || next === JSON.stringify(current)) return
387
393
  lastEmitted = next
388
394
  e.commands.setContent(value ?? '', { emitUpdate: false })
389
395
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.333",
3
+ "version": "0.1.334",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",