@meistrari/minuta-react 1.3.0 → 1.4.0

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/README.md CHANGED
@@ -73,6 +73,28 @@ const t = editor.current?.tiptap
73
73
  <MinutaEditor ref={editor} html={html} toolbar={false} onTransaction={rerender} />
74
74
  ```
75
75
 
76
+ ### Numerar parágrafo
77
+
78
+ O número dos parágrafos da peça ("12. A Ré…") é um nó próprio, não texto:
79
+ continua a sequência do template e sai como numeração nativa no Word. Com a
80
+ toolbar do pacote há o botão **1.**; numa toolbar própria:
81
+
82
+ ```tsx
83
+ import { hasLeadingTopicNumber, toggleTopicNumber } from '@meistrari/minuta-react'
84
+
85
+ // `editor.current` é null até o mount: proteja a leitura no render
86
+ const tiptap = editor.current?.tiptap
87
+ <Button type={tiptap && hasLeadingTopicNumber(tiptap) ? 'primary' : 'default'}
88
+ onClick={() => tiptap && toggleTopicNumber(tiptap)}>1.</Button>
89
+ ```
90
+
91
+ (`toggleTopicNumber` equivale a `tiptap.chain().focus().toggleTopicNumber().run()`;
92
+ há também `setTopicNumber()` e `unsetTopicNumber()`.) Enter no fim de um
93
+ parágrafo numerado já cria o seguinte numerado, sem botão. **Não** use a
94
+ "lista numerada" (`toggleOrderedList`) para isso: ela cria uma lista com recuo
95
+ próprio, fora da sequência da peça.
96
+
97
+
76
98
  Os tipos de `chain().toggleBold()` viajam com o pacote — não precisa importar
77
99
  `@tiptap/*` no seu código.
78
100
 
@@ -185,6 +207,26 @@ Sobre o fluxo de "enviar variáveis de volta": com uma edição viva o documento
185
207
  modelo do defesa.ai), ou você mantém os dois vivos com `setVariableValue` +
186
208
  salva a edição. Decisão de UX do seu app; as duas funcionam.
187
209
 
210
+ ### Voltar ao checklist sem perder a edição
211
+
212
+ Esqueceu uma tese ou variável no meio da edição? Mude o caso (`PATCH
213
+ /data/case/:id`), busque o documento que o checklist gera agora e aplique sobre
214
+ o texto editado — só o que mudou entra, e trecho que o advogado editou vira
215
+ pergunta em vez de ser sobrescrito:
216
+
217
+ ```tsx
218
+ const { html } = await api.get(`/data/case/${caseId}/html?source=blocks`)
219
+ const result = editor.current!.applyChecklist(html)
220
+ for (const c of result.conflicts) // 'replace' | 'remove' — a UI é sua
221
+ editor.current!.resolveChecklistConflict(c.blockId, 'keep' /* ou 'apply' */)
222
+ // DEPOIS das decisões: bloco inserido ou aceito pode trazer imagem vault://
223
+ await editor.current!.refreshVaultImages(resolver)
224
+ ```
225
+
226
+ Para isso funcionar a edição precisa nascer marcada: depois de montar o editor
227
+ com o HTML do checklist, antes do primeiro save, chame
228
+ `editor.current!.stampGenerated()`.
229
+
188
230
  ### Imagens inseridas pelo advogado
189
231
 
190
232
  `uploadImage` devolve `{ src, vaultSrc }`: o editor grava a tag com o `src`
package/dist/index.d.mts CHANGED
@@ -18,7 +18,7 @@
18
18
  import * as react from 'react';
19
19
  import { CSSProperties } from 'react';
20
20
  import { MinutaMargins, MinutaHeader, MinutaChromeText, MinutaVariableCatalog, MinutaEditorOptions, MinutaVariableRef, MinutaEditor as MinutaEditor$1 } from '@meistrari/minuta-editor';
21
- export { MinutaChromeText, MinutaEditor as MinutaEditorInstance, MinutaEditorOptions, MinutaHeader, MinutaMargins, MinutaVariableCatalog, MinutaVariableDef, MinutaVariableRef, extractTemplateVariables, resolveTemplateVariables } from '@meistrari/minuta-editor';
21
+ export { MinutaChromeText, MinutaEditor as MinutaEditorInstance, MinutaEditorOptions, MinutaHeader, MinutaMargins, MinutaVariableCatalog, MinutaVariableDef, MinutaVariableRef, extractTemplateVariables, hasLeadingTopicNumber, resolveTemplateVariables, toggleTopicNumber } from '@meistrari/minuta-editor';
22
22
 
23
23
  interface MinutaEditorProps {
24
24
  /**
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  import * as react from 'react';
19
19
  import { CSSProperties } from 'react';
20
20
  import { MinutaMargins, MinutaHeader, MinutaChromeText, MinutaVariableCatalog, MinutaEditorOptions, MinutaVariableRef, MinutaEditor as MinutaEditor$1 } from '@meistrari/minuta-editor';
21
- export { MinutaChromeText, MinutaEditor as MinutaEditorInstance, MinutaEditorOptions, MinutaHeader, MinutaMargins, MinutaVariableCatalog, MinutaVariableDef, MinutaVariableRef, extractTemplateVariables, resolveTemplateVariables } from '@meistrari/minuta-editor';
21
+ export { MinutaChromeText, MinutaEditor as MinutaEditorInstance, MinutaEditorOptions, MinutaHeader, MinutaMargins, MinutaVariableCatalog, MinutaVariableDef, MinutaVariableRef, extractTemplateVariables, hasLeadingTopicNumber, resolveTemplateVariables, toggleTopicNumber } from '@meistrari/minuta-editor';
22
22
 
23
23
  interface MinutaEditorProps {
24
24
  /**
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { forwardRef, useRef, useLayoutEffect, useEffect, useImperativeHandle, createElement } from 'react';
3
3
  import { createMinutaEditor } from '@meistrari/minuta-editor';
4
- export { extractTemplateVariables, resolveTemplateVariables } from '@meistrari/minuta-editor';
4
+ export { extractTemplateVariables, hasLeadingTopicNumber, resolveTemplateVariables, toggleTopicNumber } from '@meistrari/minuta-editor';
5
5
 
6
6
  const MinutaEditor = forwardRef((props, ref) => {
7
7
  const host = useRef(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/minuta-react",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Componente React do editor de minuta do defesa.ai — casca fina sobre @meistrari/minuta-editor",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "test:pack": "node scripts/verify-pack.mjs"
29
29
  },
30
30
  "dependencies": {
31
- "@meistrari/minuta-editor": "^1.0.0",
31
+ "@meistrari/minuta-editor": "^1.7.0",
32
32
  "@tiptap/core": "2.11.9",
33
33
  "@tiptap/extension-blockquote": "2.11.9",
34
34
  "@tiptap/extension-bold": "2.11.9",