@portabletext/editor 1.0.8 → 1.0.10
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/lib/index.d.mts +18 -5
- package/lib/index.d.ts +18 -5
- package/lib/index.esm.js +188 -177
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +187 -176
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +188 -177
- package/lib/index.mjs.map +1 -1
- package/package.json +20 -22
- package/src/editor/Editable.tsx +4 -7
- package/src/editor/PortableTextEditor.tsx +31 -17
- package/src/editor/__tests__/RangeDecorations.test.tsx +4 -4
- package/src/editor/components/Synchronizer.tsx +15 -46
- package/src/editor/hooks/usePortableTextEditor.ts +1 -0
- package/src/editor/hooks/usePortableTextEditorKeyGenerator.ts +3 -0
- package/src/editor/hooks/usePortableTextEditorSelection.tsx +63 -0
- package/src/editor/plugins/createWithHotKeys.ts +5 -1
- package/src/types/editor.ts +7 -0
- package/src/types/options.ts +6 -0
- package/src/utils/withChanges.ts +0 -7
- package/src/editor/hooks/usePortableTextEditorSelection.ts +0 -22
- package/src/editor/hooks/usePortableTextEditorValue.ts +0 -16
- package/src/utils/bufferUntil.ts +0 -15
package/lib/index.d.mts
CHANGED
|
@@ -136,6 +136,9 @@ export declare type ConnectionChange = {
|
|
|
136
136
|
value: 'online' | 'offline'
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
139
142
|
export declare type createEditorOptions = {
|
|
140
143
|
keyGenerator: () => string
|
|
141
144
|
patches$?: PatchObservable
|
|
@@ -223,6 +226,9 @@ export declare type EditorChange =
|
|
|
223
226
|
| UnsetChange
|
|
224
227
|
| ValueChange
|
|
225
228
|
|
|
229
|
+
/**
|
|
230
|
+
* @beta
|
|
231
|
+
*/
|
|
226
232
|
export declare type EditorChanges = Subject<EditorChange>
|
|
227
233
|
|
|
228
234
|
/** @internal */
|
|
@@ -276,6 +282,9 @@ export declare type HistoryItem = {
|
|
|
276
282
|
timestamp: Date
|
|
277
283
|
}
|
|
278
284
|
|
|
285
|
+
/**
|
|
286
|
+
* @beta
|
|
287
|
+
*/
|
|
279
288
|
export declare type HotkeyOptions = {
|
|
280
289
|
marks?: Record<string, string>
|
|
281
290
|
custom?: Record<string, (event: BaseSyntheticEvent, editor: PortableTextEditor) => void>
|
|
@@ -313,6 +322,9 @@ export declare type InvalidValueResolution = {
|
|
|
313
322
|
}
|
|
314
323
|
}
|
|
315
324
|
|
|
325
|
+
/**
|
|
326
|
+
* @public
|
|
327
|
+
*/
|
|
316
328
|
export declare const keyGenerator: () => string
|
|
317
329
|
|
|
318
330
|
/**
|
|
@@ -357,6 +369,9 @@ export declare type OnPasteResult =
|
|
|
357
369
|
}
|
|
358
370
|
| undefined
|
|
359
371
|
|
|
372
|
+
/**
|
|
373
|
+
* @beta
|
|
374
|
+
*/
|
|
360
375
|
export declare type OnPasteResultOrPromise = OnPasteResult | Promise<OnPasteResult>
|
|
361
376
|
|
|
362
377
|
/** @beta */
|
|
@@ -456,6 +471,7 @@ export declare class PortableTextEditor extends Component<PortableTextEditorProp
|
|
|
456
471
|
constructor(props: PortableTextEditorProps)
|
|
457
472
|
componentDidUpdate(prevProps: PortableTextEditorProps): void
|
|
458
473
|
setEditable: (editable: EditableAPI) => void
|
|
474
|
+
private getValue
|
|
459
475
|
render(): JSX_2.Element
|
|
460
476
|
static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject[]
|
|
461
477
|
static isAnnotationActive: (
|
|
@@ -544,11 +560,6 @@ export declare class PortableTextEditor extends Component<PortableTextEditorProp
|
|
|
544
560
|
) => boolean | undefined
|
|
545
561
|
}
|
|
546
562
|
|
|
547
|
-
/**
|
|
548
|
-
* Props for the PortableTextEditor component
|
|
549
|
-
*
|
|
550
|
-
* @public
|
|
551
|
-
*/
|
|
552
563
|
/**
|
|
553
564
|
* Props for the PortableTextEditor component
|
|
554
565
|
*
|
|
@@ -821,11 +832,13 @@ export declare type UnsetChange = {
|
|
|
821
832
|
}
|
|
822
833
|
|
|
823
834
|
/**
|
|
835
|
+
* @public
|
|
824
836
|
* Get the current editor object from the React context.
|
|
825
837
|
*/
|
|
826
838
|
export declare const usePortableTextEditor: () => PortableTextEditor
|
|
827
839
|
|
|
828
840
|
/**
|
|
841
|
+
* @public
|
|
829
842
|
* Get the current editor selection from the React context.
|
|
830
843
|
*/
|
|
831
844
|
export declare const usePortableTextEditorSelection: () => EditorSelection
|
package/lib/index.d.ts
CHANGED
|
@@ -136,6 +136,9 @@ export declare type ConnectionChange = {
|
|
|
136
136
|
value: 'online' | 'offline'
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
139
142
|
export declare type createEditorOptions = {
|
|
140
143
|
keyGenerator: () => string
|
|
141
144
|
patches$?: PatchObservable
|
|
@@ -223,6 +226,9 @@ export declare type EditorChange =
|
|
|
223
226
|
| UnsetChange
|
|
224
227
|
| ValueChange
|
|
225
228
|
|
|
229
|
+
/**
|
|
230
|
+
* @beta
|
|
231
|
+
*/
|
|
226
232
|
export declare type EditorChanges = Subject<EditorChange>
|
|
227
233
|
|
|
228
234
|
/** @internal */
|
|
@@ -276,6 +282,9 @@ export declare type HistoryItem = {
|
|
|
276
282
|
timestamp: Date
|
|
277
283
|
}
|
|
278
284
|
|
|
285
|
+
/**
|
|
286
|
+
* @beta
|
|
287
|
+
*/
|
|
279
288
|
export declare type HotkeyOptions = {
|
|
280
289
|
marks?: Record<string, string>
|
|
281
290
|
custom?: Record<string, (event: BaseSyntheticEvent, editor: PortableTextEditor) => void>
|
|
@@ -313,6 +322,9 @@ export declare type InvalidValueResolution = {
|
|
|
313
322
|
}
|
|
314
323
|
}
|
|
315
324
|
|
|
325
|
+
/**
|
|
326
|
+
* @public
|
|
327
|
+
*/
|
|
316
328
|
export declare const keyGenerator: () => string
|
|
317
329
|
|
|
318
330
|
/**
|
|
@@ -357,6 +369,9 @@ export declare type OnPasteResult =
|
|
|
357
369
|
}
|
|
358
370
|
| undefined
|
|
359
371
|
|
|
372
|
+
/**
|
|
373
|
+
* @beta
|
|
374
|
+
*/
|
|
360
375
|
export declare type OnPasteResultOrPromise = OnPasteResult | Promise<OnPasteResult>
|
|
361
376
|
|
|
362
377
|
/** @beta */
|
|
@@ -456,6 +471,7 @@ export declare class PortableTextEditor extends Component<PortableTextEditorProp
|
|
|
456
471
|
constructor(props: PortableTextEditorProps)
|
|
457
472
|
componentDidUpdate(prevProps: PortableTextEditorProps): void
|
|
458
473
|
setEditable: (editable: EditableAPI) => void
|
|
474
|
+
private getValue
|
|
459
475
|
render(): JSX_2.Element
|
|
460
476
|
static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject[]
|
|
461
477
|
static isAnnotationActive: (
|
|
@@ -544,11 +560,6 @@ export declare class PortableTextEditor extends Component<PortableTextEditorProp
|
|
|
544
560
|
) => boolean | undefined
|
|
545
561
|
}
|
|
546
562
|
|
|
547
|
-
/**
|
|
548
|
-
* Props for the PortableTextEditor component
|
|
549
|
-
*
|
|
550
|
-
* @public
|
|
551
|
-
*/
|
|
552
563
|
/**
|
|
553
564
|
* Props for the PortableTextEditor component
|
|
554
565
|
*
|
|
@@ -821,11 +832,13 @@ export declare type UnsetChange = {
|
|
|
821
832
|
}
|
|
822
833
|
|
|
823
834
|
/**
|
|
835
|
+
* @public
|
|
824
836
|
* Get the current editor object from the React context.
|
|
825
837
|
*/
|
|
826
838
|
export declare const usePortableTextEditor: () => PortableTextEditor
|
|
827
839
|
|
|
828
840
|
/**
|
|
841
|
+
* @public
|
|
829
842
|
* Get the current editor selection from the React context.
|
|
830
843
|
*/
|
|
831
844
|
export declare const usePortableTextEditorSelection: () => EditorSelection
|