@prezly/slate-lists
Advanced tools
Comparing version
@@ -22,2 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var slate_commons_1 = require("@prezly/slate-commons"); | ||
var slate_1 = require("slate"); | ||
@@ -32,4 +33,11 @@ var getListsInRange_1 = __importDefault(require("./getListsInRange")); | ||
} | ||
var listEntries = getListsInRange_1.default(options, editor, editor.selection); | ||
listEntries.forEach(function (listEntry) { | ||
var lists = getListsInRange_1.default(options, editor, editor.selection); | ||
var listsIds = lists.map(function (list) { return slate_commons_1.nodeIdManager.assign(editor, list); }); | ||
listsIds.forEach(function (id) { | ||
var listEntry = slate_commons_1.nodeIdManager.get(editor, id); | ||
slate_commons_1.nodeIdManager.unassign(editor, id); | ||
if (!listEntry) { | ||
// It should never happen. | ||
return; | ||
} | ||
var _a = __read(listEntry, 2), listPath = _a[1]; | ||
@@ -36,0 +44,0 @@ slate_1.Transforms.setNodes(editor, { type: listType }, { at: listPath }); |
{ | ||
"name": "@prezly/slate-lists", | ||
"version": "0.1.0-alpha.24", | ||
"version": "0.1.0-alpha.25", | ||
"description": "The best Slate lists extension out there", | ||
@@ -30,4 +30,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@prezly/slate-commons": "^0.1.0-alpha.24", | ||
"@prezly/slate-hyperscript": "^0.1.0-alpha.24", | ||
"@prezly/slate-commons": "^0.1.0-alpha.25", | ||
"@prezly/slate-hyperscript": "^0.1.0-alpha.25", | ||
"uuid": "^8.3.2" | ||
@@ -39,3 +39,3 @@ }, | ||
}, | ||
"gitHead": "89102b541ff86922cf72ed37d737c338c27582dd" | ||
"gitHead": "85531f0ec22a3301d463a2b7801764b4208cd4e9" | ||
} |
@@ -0,1 +1,2 @@ | ||
import { nodeIdManager } from '@prezly/slate-commons'; | ||
import { Editor, Transforms } from 'slate'; | ||
@@ -15,5 +16,14 @@ | ||
const listEntries = getListsInRange(options, editor, editor.selection); | ||
const lists = getListsInRange(options, editor, editor.selection); | ||
const listsIds = lists.map((list) => nodeIdManager.assign(editor, list)); | ||
listEntries.forEach((listEntry) => { | ||
listsIds.forEach((id) => { | ||
const listEntry = nodeIdManager.get(editor, id); | ||
nodeIdManager.unassign(editor, id); | ||
if (!listEntry) { | ||
// It should never happen. | ||
return; | ||
} | ||
const [, listPath] = listEntry; | ||
@@ -20,0 +30,0 @@ Transforms.setNodes(editor, { type: listType }, { at: listPath }); |
Sorry, the diff of this file is not supported yet
336828
0.3%6772
0.24%