@milkdown/preset-commonmark 7.19.2 → 7.20.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/lib/index.js +9 -6
- package/lib/index.js.map +1 -1
- package/lib/node/ordered-list.d.ts.map +1 -1
- package/lib/plugin/sync-list-order-plugin.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/node/ordered-list.ts +6 -3
- package/src/plugin/sync-list-order-plugin.ts +5 -3
package/lib/index.js
CHANGED
|
@@ -1243,7 +1243,7 @@ var orderedListSchema = $nodeSchema("ordered_list", (ctx) => ({
|
|
|
1243
1243
|
"ol",
|
|
1244
1244
|
{
|
|
1245
1245
|
...ctx.get(orderedListAttr.key)(node),
|
|
1246
|
-
...node.attrs.order === 1 ? {} : node.attrs.order,
|
|
1246
|
+
...node.attrs.order === 1 ? {} : { start: node.attrs.order },
|
|
1247
1247
|
"data-spread": node.attrs.spread
|
|
1248
1248
|
},
|
|
1249
1249
|
0
|
|
@@ -1252,7 +1252,10 @@ var orderedListSchema = $nodeSchema("ordered_list", (ctx) => ({
|
|
|
1252
1252
|
match: ({ type, ordered }) => type === "list" && !!ordered,
|
|
1253
1253
|
runner: (state, node, type) => {
|
|
1254
1254
|
const spread = node.spread != null ? `${node.spread}` : "true";
|
|
1255
|
-
state.openNode(type, {
|
|
1255
|
+
state.openNode(type, {
|
|
1256
|
+
spread,
|
|
1257
|
+
order: node.start ?? 1
|
|
1258
|
+
}).next(node.children).closeNode();
|
|
1256
1259
|
}
|
|
1257
1260
|
},
|
|
1258
1261
|
toMarkdown: {
|
|
@@ -1260,7 +1263,7 @@ var orderedListSchema = $nodeSchema("ordered_list", (ctx) => ({
|
|
|
1260
1263
|
runner: (state, node) => {
|
|
1261
1264
|
state.openNode("list", void 0, {
|
|
1262
1265
|
ordered: true,
|
|
1263
|
-
start: 1,
|
|
1266
|
+
start: node.attrs.order ?? 1,
|
|
1264
1267
|
spread: node.attrs.spread === "true"
|
|
1265
1268
|
});
|
|
1266
1269
|
state.next(node.content);
|
|
@@ -2029,9 +2032,9 @@ var syncListOrderPlugin = $prose((ctx) => {
|
|
|
2029
2032
|
const orderedListType = orderedListSchema.type(ctx);
|
|
2030
2033
|
const bulletListType = bulletListSchema.type(ctx);
|
|
2031
2034
|
const listItemType = listItemSchema.type(ctx);
|
|
2032
|
-
const handleNodeItem = (attrs, index) => {
|
|
2035
|
+
const handleNodeItem = (attrs, index, order = 1) => {
|
|
2033
2036
|
let changed = false;
|
|
2034
|
-
const expectedLabel = `${index +
|
|
2037
|
+
const expectedLabel = `${index + order}.`;
|
|
2035
2038
|
if (attrs.label !== expectedLabel) {
|
|
2036
2039
|
attrs.label = expectedLabel;
|
|
2037
2040
|
changed = true;
|
|
@@ -2061,7 +2064,7 @@ var syncListOrderPlugin = $prose((ctx) => {
|
|
|
2061
2064
|
attrs.listType = "ordered";
|
|
2062
2065
|
changed = true;
|
|
2063
2066
|
}
|
|
2064
|
-
if (parent?.maybeChild(0)) changed = handleNodeItem(attrs, index);
|
|
2067
|
+
if (parent?.maybeChild(0)) changed = handleNodeItem(attrs, index, parent?.attrs.order ?? 1);
|
|
2065
2068
|
if (changed) {
|
|
2066
2069
|
tr = tr.setNodeMarkup(pos, void 0, attrs);
|
|
2067
2070
|
needDispatch = true;
|