@superdoc-dev/cli 0.2.0-next.89 → 0.2.0-next.90
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/index.js +149 -16
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1231,6 +1231,21 @@ var init_operation_definitions = __esm(() => {
|
|
|
1231
1231
|
referenceDocPath: "info.mdx",
|
|
1232
1232
|
referenceGroup: "core"
|
|
1233
1233
|
},
|
|
1234
|
+
clearContent: {
|
|
1235
|
+
memberPath: "clearContent",
|
|
1236
|
+
description: "Clear all document body content, leaving a single empty paragraph.",
|
|
1237
|
+
expectedResult: "Returns a Receipt with success status; reports NO_OP if the document is already empty.",
|
|
1238
|
+
requiresDocumentContext: true,
|
|
1239
|
+
metadata: mutationOperation({
|
|
1240
|
+
idempotency: "conditional",
|
|
1241
|
+
supportsDryRun: false,
|
|
1242
|
+
supportsTrackedMode: false,
|
|
1243
|
+
possibleFailureCodes: ["NO_OP"],
|
|
1244
|
+
throws: ["CAPABILITY_UNAVAILABLE"]
|
|
1245
|
+
}),
|
|
1246
|
+
referenceDocPath: "clear-content.mdx",
|
|
1247
|
+
referenceGroup: "core"
|
|
1248
|
+
},
|
|
1234
1249
|
insert: {
|
|
1235
1250
|
memberPath: "insert",
|
|
1236
1251
|
description: "Insert content at a target position, or at the end of the document when target is omitted. Supports text (default), markdown, and html content types via the `type` field.",
|
|
@@ -6017,6 +6032,12 @@ var init_schemas = __esm(() => {
|
|
|
6017
6032
|
input: strictEmptyObjectSchema,
|
|
6018
6033
|
output: documentInfoSchema
|
|
6019
6034
|
},
|
|
6035
|
+
clearContent: {
|
|
6036
|
+
input: strictEmptyObjectSchema,
|
|
6037
|
+
output: receiptResultSchemaFor("clearContent"),
|
|
6038
|
+
success: receiptSuccessSchema,
|
|
6039
|
+
failure: receiptFailureResultSchemaFor("clearContent")
|
|
6040
|
+
},
|
|
6020
6041
|
insert: {
|
|
6021
6042
|
input: insertInputSchema,
|
|
6022
6043
|
output: textMutationResultSchemaFor("insert"),
|
|
@@ -8801,6 +8822,11 @@ function executeInfo(adapter, input) {
|
|
|
8801
8822
|
return adapter.info(input);
|
|
8802
8823
|
}
|
|
8803
8824
|
|
|
8825
|
+
// ../../packages/document-api/src/clear-content/clear-content.ts
|
|
8826
|
+
function executeClearContent(adapter, input, options) {
|
|
8827
|
+
return adapter.clearContent(input, options);
|
|
8828
|
+
}
|
|
8829
|
+
|
|
8804
8830
|
// ../../packages/document-api/src/delete/delete.ts
|
|
8805
8831
|
function validateDeleteInput(input) {
|
|
8806
8832
|
if (!isRecord(input)) {
|
|
@@ -9275,6 +9301,7 @@ function buildDispatchTable(api) {
|
|
|
9275
9301
|
getMarkdown: (input) => api.getMarkdown(input),
|
|
9276
9302
|
getHtml: (input) => api.getHtml(input),
|
|
9277
9303
|
info: (input) => api.info(input),
|
|
9304
|
+
clearContent: (input, options) => api.clearContent(input, options),
|
|
9278
9305
|
insert: (input, options) => api.insert(input, options),
|
|
9279
9306
|
replace: (input, options) => api.replace(input, options),
|
|
9280
9307
|
delete: (input, options) => api.delete(input, options),
|
|
@@ -10380,6 +10407,9 @@ function createDocumentApi(adapters) {
|
|
|
10380
10407
|
info(input) {
|
|
10381
10408
|
return executeInfo(adapters.info, input);
|
|
10382
10409
|
},
|
|
10410
|
+
clearContent(input, options) {
|
|
10411
|
+
return executeClearContent(adapters.clearContent, input, options);
|
|
10412
|
+
},
|
|
10383
10413
|
comments: {
|
|
10384
10414
|
create(input, options) {
|
|
10385
10415
|
return executeCommentsCreate(adapters.comments, input, options);
|
|
@@ -11683,6 +11713,7 @@ var init_operation_hints = __esm(() => {
|
|
|
11683
11713
|
getMarkdown: "extracted markdown",
|
|
11684
11714
|
getHtml: "extracted html",
|
|
11685
11715
|
info: "retrieved info",
|
|
11716
|
+
clearContent: "cleared document content",
|
|
11686
11717
|
insert: "inserted text",
|
|
11687
11718
|
replace: "replaced text",
|
|
11688
11719
|
delete: "deleted text",
|
|
@@ -11813,6 +11844,7 @@ var init_operation_hints = __esm(() => {
|
|
|
11813
11844
|
getMarkdown: "plain",
|
|
11814
11845
|
getHtml: "plain",
|
|
11815
11846
|
info: "documentInfo",
|
|
11847
|
+
clearContent: "receipt",
|
|
11816
11848
|
insert: "mutationReceipt",
|
|
11817
11849
|
replace: "mutationReceipt",
|
|
11818
11850
|
delete: "mutationReceipt",
|
|
@@ -11943,6 +11975,7 @@ var init_operation_hints = __esm(() => {
|
|
|
11943
11975
|
getMarkdown: "markdown",
|
|
11944
11976
|
getHtml: "html",
|
|
11945
11977
|
info: null,
|
|
11978
|
+
clearContent: "receipt",
|
|
11946
11979
|
insert: null,
|
|
11947
11980
|
replace: null,
|
|
11948
11981
|
delete: null,
|
|
@@ -12080,6 +12113,7 @@ var init_operation_hints = __esm(() => {
|
|
|
12080
12113
|
getMarkdown: "query",
|
|
12081
12114
|
getHtml: "query",
|
|
12082
12115
|
info: "general",
|
|
12116
|
+
clearContent: "general",
|
|
12083
12117
|
insert: "textMutation",
|
|
12084
12118
|
replace: "textMutation",
|
|
12085
12119
|
delete: "textMutation",
|
|
@@ -33220,7 +33254,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
33220
33254
|
emptyOptions2 = {};
|
|
33221
33255
|
});
|
|
33222
33256
|
|
|
33223
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
33257
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-WVv8Qhfn.es.js
|
|
33224
33258
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
33225
33259
|
const fieldValue = extension$1.config[field];
|
|
33226
33260
|
if (typeof fieldValue === "function")
|
|
@@ -35453,6 +35487,9 @@ function executeGetHtml2(adapter, input) {
|
|
|
35453
35487
|
function executeInfo2(adapter, input) {
|
|
35454
35488
|
return adapter.info(input);
|
|
35455
35489
|
}
|
|
35490
|
+
function executeClearContent2(adapter, input, options) {
|
|
35491
|
+
return adapter.clearContent(input, options);
|
|
35492
|
+
}
|
|
35456
35493
|
function validateDeleteInput2(input) {
|
|
35457
35494
|
if (!isRecord3(input))
|
|
35458
35495
|
throw new DocumentApiValidationError2("INVALID_TARGET", "Delete input must be a non-null object.");
|
|
@@ -35859,6 +35896,7 @@ function buildDispatchTable2(api) {
|
|
|
35859
35896
|
getMarkdown: (input) => api.getMarkdown(input),
|
|
35860
35897
|
getHtml: (input) => api.getHtml(input),
|
|
35861
35898
|
info: (input) => api.info(input),
|
|
35899
|
+
clearContent: (input, options) => api.clearContent(input, options),
|
|
35862
35900
|
insert: (input, options) => api.insert(input, options),
|
|
35863
35901
|
replace: (input, options) => api.replace(input, options),
|
|
35864
35902
|
delete: (input, options) => api.delete(input, options),
|
|
@@ -36783,6 +36821,9 @@ function createDocumentApi2(adapters) {
|
|
|
36783
36821
|
info(input) {
|
|
36784
36822
|
return executeInfo2(adapters.info, input);
|
|
36785
36823
|
},
|
|
36824
|
+
clearContent(input, options) {
|
|
36825
|
+
return executeClearContent2(adapters.clearContent, input, options);
|
|
36826
|
+
},
|
|
36786
36827
|
comments: {
|
|
36787
36828
|
create(input, options) {
|
|
36788
36829
|
return executeCommentsCreate2(adapters.comments, input, options);
|
|
@@ -65012,7 +65053,7 @@ var isRegExp = (value) => {
|
|
|
65012
65053
|
state.kern = kernNode.attributes["w:val"];
|
|
65013
65054
|
}
|
|
65014
65055
|
}, SuperConverter;
|
|
65015
|
-
var
|
|
65056
|
+
var init_SuperConverter_WVv8Qhfn_es = __esm(() => {
|
|
65016
65057
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
65017
65058
|
init_jszip_ChlR43oI_es();
|
|
65018
65059
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -67894,6 +67935,21 @@ var init_SuperConverter_CHHvo5ta_es = __esm(() => {
|
|
|
67894
67935
|
referenceDocPath: "info.mdx",
|
|
67895
67936
|
referenceGroup: "core"
|
|
67896
67937
|
},
|
|
67938
|
+
clearContent: {
|
|
67939
|
+
memberPath: "clearContent",
|
|
67940
|
+
description: "Clear all document body content, leaving a single empty paragraph.",
|
|
67941
|
+
expectedResult: "Returns a Receipt with success status; reports NO_OP if the document is already empty.",
|
|
67942
|
+
requiresDocumentContext: true,
|
|
67943
|
+
metadata: mutationOperation2({
|
|
67944
|
+
idempotency: "conditional",
|
|
67945
|
+
supportsDryRun: false,
|
|
67946
|
+
supportsTrackedMode: false,
|
|
67947
|
+
possibleFailureCodes: ["NO_OP"],
|
|
67948
|
+
throws: ["CAPABILITY_UNAVAILABLE"]
|
|
67949
|
+
}),
|
|
67950
|
+
referenceDocPath: "clear-content.mdx",
|
|
67951
|
+
referenceGroup: "core"
|
|
67952
|
+
},
|
|
67897
67953
|
insert: {
|
|
67898
67954
|
memberPath: "insert",
|
|
67899
67955
|
description: "Insert content at a target position, or at the end of the document when target is omitted. Supports text (default), markdown, and html content types via the `type` field.",
|
|
@@ -72609,7 +72665,7 @@ var init_SuperConverter_CHHvo5ta_es = __esm(() => {
|
|
|
72609
72665
|
objectSchema2({
|
|
72610
72666
|
nodeId: { type: "string" },
|
|
72611
72667
|
nodeType: { enum: [...blockNodeTypeValues2] }
|
|
72612
|
-
}, ["nodeId"]), objectSchema2({ unflattenLists: { type: "boolean" } }), textMutationResultSchemaFor2("insert"), textMutationFailureSchemaFor2("insert"), objectSchema2({
|
|
72668
|
+
}, ["nodeId"]), objectSchema2({ unflattenLists: { type: "boolean" } }), receiptResultSchemaFor2("clearContent"), receiptFailureResultSchemaFor2("clearContent"), textMutationResultSchemaFor2("insert"), textMutationFailureSchemaFor2("insert"), objectSchema2({
|
|
72613
72669
|
target: textAddressSchema2,
|
|
72614
72670
|
text: { type: "string" }
|
|
72615
72671
|
}, ["target", "text"]), textMutationResultSchemaFor2("replace"), textMutationFailureSchemaFor2("replace"), objectSchema2({ target: textAddressSchema2 }, ["target"]), textMutationResultSchemaFor2("delete"), textMutationFailureSchemaFor2("delete"), objectSchema2({
|
|
@@ -121745,9 +121801,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
121745
121801
|
init_remark_gfm_z_sDF4ss_es();
|
|
121746
121802
|
});
|
|
121747
121803
|
|
|
121748
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
121749
|
-
var
|
|
121750
|
-
__export(
|
|
121804
|
+
// ../../packages/superdoc/dist/chunks/src-BpEuYrQh.es.js
|
|
121805
|
+
var exports_src_BpEuYrQh_es = {};
|
|
121806
|
+
__export(exports_src_BpEuYrQh_es, {
|
|
121751
121807
|
zt: () => defineMark,
|
|
121752
121808
|
z: () => cM,
|
|
121753
121809
|
yt: () => removeAwarenessStates,
|
|
@@ -134404,6 +134460,42 @@ function createCommentsWrapper(editor) {
|
|
|
134404
134460
|
list: (query2) => listCommentsHandler(editor, query2)
|
|
134405
134461
|
};
|
|
134406
134462
|
}
|
|
134463
|
+
function isDocumentEmpty(editor) {
|
|
134464
|
+
const { doc: doc$2 } = editor.state;
|
|
134465
|
+
if (doc$2.childCount !== 1)
|
|
134466
|
+
return false;
|
|
134467
|
+
const firstChild = doc$2.firstChild;
|
|
134468
|
+
return firstChild?.type.name === "paragraph" && firstChild.childCount === 0;
|
|
134469
|
+
}
|
|
134470
|
+
function clearContentWrapper(editor, _input, options) {
|
|
134471
|
+
const paragraphType = editor.state.schema.nodes.paragraph;
|
|
134472
|
+
if (!paragraphType)
|
|
134473
|
+
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "clearContent requires the paragraph node type in the schema.", { reason: "missing_schema_node" });
|
|
134474
|
+
if (isDocumentEmpty(editor))
|
|
134475
|
+
return {
|
|
134476
|
+
success: false,
|
|
134477
|
+
failure: {
|
|
134478
|
+
code: "NO_OP",
|
|
134479
|
+
message: "Document is already empty."
|
|
134480
|
+
}
|
|
134481
|
+
};
|
|
134482
|
+
if (!(executeDomainCommand(editor, () => {
|
|
134483
|
+
const { state } = editor;
|
|
134484
|
+
const emptyParagraph = paragraphType.create();
|
|
134485
|
+
const tr = state.tr.replaceWith(0, state.doc.content.size, emptyParagraph);
|
|
134486
|
+
editor.dispatch(tr);
|
|
134487
|
+
clearIndexCache(editor);
|
|
134488
|
+
return true;
|
|
134489
|
+
}, { expectedRevision: options?.expectedRevision }).steps[0]?.effect === "changed"))
|
|
134490
|
+
return {
|
|
134491
|
+
success: false,
|
|
134492
|
+
failure: {
|
|
134493
|
+
code: "NO_OP",
|
|
134494
|
+
message: "Clear command produced no change."
|
|
134495
|
+
}
|
|
134496
|
+
};
|
|
134497
|
+
return { success: true };
|
|
134498
|
+
}
|
|
134407
134499
|
function executeOutOfBandMutation(editor, mutateFn, options) {
|
|
134408
134500
|
if (!options.dryRun)
|
|
134409
134501
|
if (editor.options?.collaborationProvider && editor.options?.ydoc)
|
|
@@ -145272,6 +145364,7 @@ function assembleDocumentApiAdapters(editor) {
|
|
|
145272
145364
|
getMarkdown: { getMarkdown: (input2) => getMarkdownAdapter(editor, input2) },
|
|
145273
145365
|
getHtml: { getHtml: (input2) => getHtmlAdapter(editor, input2) },
|
|
145274
145366
|
info: { info: (input2) => infoAdapter(editor, input2) },
|
|
145367
|
+
clearContent: { clearContent: (input2, options) => clearContentWrapper(editor, input2, options) },
|
|
145275
145368
|
capabilities: { get: () => getDocumentApiCapabilities(editor) },
|
|
145276
145369
|
comments: createCommentsWrapper(editor),
|
|
145277
145370
|
write: {
|
|
@@ -198796,9 +198889,9 @@ var Node$13 = class Node$14 {
|
|
|
198796
198889
|
trackedChanges: context.trackedChanges ?? []
|
|
198797
198890
|
});
|
|
198798
198891
|
}, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
|
|
198799
|
-
var
|
|
198892
|
+
var init_src_BpEuYrQh_es = __esm(() => {
|
|
198800
198893
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
198801
|
-
|
|
198894
|
+
init_SuperConverter_WVv8Qhfn_es();
|
|
198802
198895
|
init_jszip_ChlR43oI_es();
|
|
198803
198896
|
init_uuid_qzgm05fK_es();
|
|
198804
198897
|
init_constants_CMPtQbp7_es();
|
|
@@ -230529,8 +230622,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230529
230622
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
230530
230623
|
};
|
|
230531
230624
|
stubFalse_default = stubFalse;
|
|
230532
|
-
freeExports$2 = typeof
|
|
230533
|
-
freeModule$2 = freeExports$2 && typeof
|
|
230625
|
+
freeExports$2 = typeof exports_src_BpEuYrQh_es == "object" && exports_src_BpEuYrQh_es && !exports_src_BpEuYrQh_es.nodeType && exports_src_BpEuYrQh_es;
|
|
230626
|
+
freeModule$2 = freeExports$2 && typeof module_src_BpEuYrQh_es == "object" && module_src_BpEuYrQh_es && !module_src_BpEuYrQh_es.nodeType && module_src_BpEuYrQh_es;
|
|
230534
230627
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
230535
230628
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
230536
230629
|
typedArrayTags = {};
|
|
@@ -230538,8 +230631,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230538
230631
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
230539
230632
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
230540
230633
|
_baseUnary_default = baseUnary;
|
|
230541
|
-
freeExports$1 = typeof
|
|
230542
|
-
freeModule$1 = freeExports$1 && typeof
|
|
230634
|
+
freeExports$1 = typeof exports_src_BpEuYrQh_es == "object" && exports_src_BpEuYrQh_es && !exports_src_BpEuYrQh_es.nodeType && exports_src_BpEuYrQh_es;
|
|
230635
|
+
freeModule$1 = freeExports$1 && typeof module_src_BpEuYrQh_es == "object" && module_src_BpEuYrQh_es && !module_src_BpEuYrQh_es.nodeType && module_src_BpEuYrQh_es;
|
|
230543
230636
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
230544
230637
|
_nodeUtil_default = function() {
|
|
230545
230638
|
try {
|
|
@@ -230644,8 +230737,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230644
230737
|
Stack.prototype.has = _stackHas_default;
|
|
230645
230738
|
Stack.prototype.set = _stackSet_default;
|
|
230646
230739
|
_Stack_default = Stack;
|
|
230647
|
-
freeExports = typeof
|
|
230648
|
-
freeModule = freeExports && typeof
|
|
230740
|
+
freeExports = typeof exports_src_BpEuYrQh_es == "object" && exports_src_BpEuYrQh_es && !exports_src_BpEuYrQh_es.nodeType && exports_src_BpEuYrQh_es;
|
|
230741
|
+
freeModule = freeExports && typeof module_src_BpEuYrQh_es == "object" && module_src_BpEuYrQh_es && !module_src_BpEuYrQh_es.nodeType && module_src_BpEuYrQh_es;
|
|
230649
230742
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
230650
230743
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
230651
230744
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -238725,8 +238818,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
238725
238818
|
|
|
238726
238819
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
238727
238820
|
var init_super_editor_es = __esm(() => {
|
|
238728
|
-
|
|
238729
|
-
|
|
238821
|
+
init_src_BpEuYrQh_es();
|
|
238822
|
+
init_SuperConverter_WVv8Qhfn_es();
|
|
238730
238823
|
init_jszip_ChlR43oI_es();
|
|
238731
238824
|
init_xml_js_DLE8mr0n_es();
|
|
238732
238825
|
init_constants_CMPtQbp7_es();
|
|
@@ -305025,6 +305118,42 @@ var init_comments_wrappers = __esm(() => {
|
|
|
305025
305118
|
init_comment_target_resolver();
|
|
305026
305119
|
});
|
|
305027
305120
|
|
|
305121
|
+
// ../../packages/super-editor/src/document-api-adapters/plan-engine/clear-content-wrapper.ts
|
|
305122
|
+
function isDocumentEmpty2(editor) {
|
|
305123
|
+
const { doc: doc4 } = editor.state;
|
|
305124
|
+
if (doc4.childCount !== 1)
|
|
305125
|
+
return false;
|
|
305126
|
+
const firstChild = doc4.firstChild;
|
|
305127
|
+
return firstChild?.type.name === "paragraph" && firstChild.childCount === 0;
|
|
305128
|
+
}
|
|
305129
|
+
function clearContentWrapper2(editor, _input, options) {
|
|
305130
|
+
const paragraphType = editor.state.schema.nodes.paragraph;
|
|
305131
|
+
if (!paragraphType) {
|
|
305132
|
+
throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "clearContent requires the paragraph node type in the schema.", { reason: "missing_schema_node" });
|
|
305133
|
+
}
|
|
305134
|
+
if (isDocumentEmpty2(editor)) {
|
|
305135
|
+
return { success: false, failure: { code: "NO_OP", message: "Document is already empty." } };
|
|
305136
|
+
}
|
|
305137
|
+
const receipt2 = executeDomainCommand2(editor, () => {
|
|
305138
|
+
const { state } = editor;
|
|
305139
|
+
const emptyParagraph = paragraphType.create();
|
|
305140
|
+
const tr = state.tr.replaceWith(0, state.doc.content.size, emptyParagraph);
|
|
305141
|
+
editor.dispatch(tr);
|
|
305142
|
+
clearIndexCache2(editor);
|
|
305143
|
+
return true;
|
|
305144
|
+
}, { expectedRevision: options?.expectedRevision });
|
|
305145
|
+
const changed = receipt2.steps[0]?.effect === "changed";
|
|
305146
|
+
if (!changed) {
|
|
305147
|
+
return { success: false, failure: { code: "NO_OP", message: "Clear command produced no change." } };
|
|
305148
|
+
}
|
|
305149
|
+
return { success: true };
|
|
305150
|
+
}
|
|
305151
|
+
var init_clear_content_wrapper = __esm(() => {
|
|
305152
|
+
init_errors3();
|
|
305153
|
+
init_index_cache();
|
|
305154
|
+
init_plan_wrappers();
|
|
305155
|
+
});
|
|
305156
|
+
|
|
305028
305157
|
// ../../packages/super-editor/src/document-api-adapters/out-of-band-mutation.ts
|
|
305029
305158
|
function executeOutOfBandMutation2(editor, mutateFn, options) {
|
|
305030
305159
|
if (!options.dryRun) {
|
|
@@ -317300,6 +317429,9 @@ function assembleDocumentApiAdapters2(editor) {
|
|
|
317300
317429
|
info: {
|
|
317301
317430
|
info: (input2) => infoAdapter2(editor, input2)
|
|
317302
317431
|
},
|
|
317432
|
+
clearContent: {
|
|
317433
|
+
clearContent: (input2, options) => clearContentWrapper2(editor, input2, options)
|
|
317434
|
+
},
|
|
317303
317435
|
capabilities: {
|
|
317304
317436
|
get: () => getDocumentApiCapabilities2(editor)
|
|
317305
317437
|
},
|
|
@@ -317516,6 +317648,7 @@ var init_assemble_adapters = __esm(() => {
|
|
|
317516
317648
|
init_capabilities_adapter();
|
|
317517
317649
|
init_comments_wrappers();
|
|
317518
317650
|
init_plan_wrappers();
|
|
317651
|
+
init_clear_content_wrapper();
|
|
317519
317652
|
init_styles_adapter();
|
|
317520
317653
|
init_paragraphs_wrappers();
|
|
317521
317654
|
init_track_changes_wrappers();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.90",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"@types/bun": "^1.3.8",
|
|
21
21
|
"@types/node": "22.19.2",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
|
-
"@superdoc/document-api": "0.0.1",
|
|
24
23
|
"@superdoc/pm-adapter": "0.0.0",
|
|
24
|
+
"@superdoc/super-editor": "0.0.1",
|
|
25
25
|
"superdoc": "1.17.0",
|
|
26
|
-
"@superdoc/
|
|
26
|
+
"@superdoc/document-api": "0.0.1"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.
|
|
35
|
-
"@superdoc-dev/cli-linux-x64": "0.2.0-next.
|
|
36
|
-
"@superdoc-dev/cli-
|
|
37
|
-
"@superdoc-dev/cli-
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.90",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.90",
|
|
35
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.90",
|
|
36
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.90",
|
|
37
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.90"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|