@udecode/plate-layout
Advanced tools
Comparing version 39.0.0 to 40.0.0
import * as _udecode_plate_core from '@udecode/plate-core'; | ||
import { TElement, ExtendEditor, TNode, SlateEditor, TNodeEntry, InsertNodesOptions } from '@udecode/plate-common'; | ||
import { TElement, ExtendEditor, SlateEditor, InsertNodesOptions, TNode, TNodeEntry, ReplaceNodeChildrenOptions } from '@udecode/plate-common'; | ||
import { PathRef } from 'slate'; | ||
@@ -22,10 +22,10 @@ | ||
declare const normalizeColumn: <N extends TNode>(editor: SlateEditor) => (entry: TNodeEntry<N>) => void; | ||
declare const insertColumnGroup: (editor: SlateEditor) => void; | ||
declare const insertEmptyColumn: <E extends SlateEditor>(editor: E, options?: { | ||
declare const insertColumn: <E extends SlateEditor>(editor: E, { width, ...options }?: { | ||
width?: string; | ||
} & InsertNodesOptions<E>) => void; | ||
declare const insertColumnGroup: (editor: SlateEditor, { layout, select: selectProp, ...options }?: InsertNodesOptions & { | ||
layout?: number[] | number; | ||
}) => void; | ||
/** | ||
@@ -41,4 +41,6 @@ * Move the middle column to the left of right by options.direction. if the | ||
declare const toggleColumns: (editor: SlateEditor, nodeEntry: TNodeEntry) => void; | ||
declare const toggleColumnGroup: (editor: SlateEditor, { at, layout, }?: Partial<Omit<ReplaceNodeChildrenOptions<TElement>, "nodes">> & { | ||
layout?: number[] | number; | ||
}) => void; | ||
export { BaseColumnItemPlugin, BaseColumnPlugin, type TColumnElement, type TColumnGroupElement, insertColumnGroup, insertEmptyColumn, moveMiddleColumn, normalizeColumn, setColumnWidth, toggleColumns, withColumn }; | ||
export { BaseColumnItemPlugin, BaseColumnPlugin, type TColumnElement, type TColumnGroupElement, insertColumn, insertColumnGroup, moveMiddleColumn, setColumnWidth, toggleColumnGroup, withColumn }; |
@@ -5,3 +5,17 @@ "use strict"; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __objRest = (source, exclude) => { | ||
var target = {}; | ||
for (var prop in source) | ||
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
target[prop] = source[prop]; | ||
if (source != null && __getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(source)) { | ||
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
target[prop] = source[prop]; | ||
} | ||
return target; | ||
}; | ||
var __export = (target, all) => { | ||
@@ -26,8 +40,7 @@ for (var name in all) | ||
BaseColumnPlugin: () => BaseColumnPlugin, | ||
insertColumn: () => insertColumn, | ||
insertColumnGroup: () => insertColumnGroup, | ||
insertEmptyColumn: () => insertEmptyColumn, | ||
moveMiddleColumn: () => moveMiddleColumn, | ||
normalizeColumn: () => normalizeColumn, | ||
setColumnWidth: () => setColumnWidth, | ||
toggleColumns: () => toggleColumns, | ||
toggleColumnGroup: () => toggleColumnGroup, | ||
withColumn: () => withColumn | ||
@@ -38,52 +51,58 @@ }); | ||
// src/lib/BaseColumnPlugin.ts | ||
var import_plate_common8 = require("@udecode/plate-common"); | ||
var import_plate_common7 = require("@udecode/plate-common"); | ||
// src/lib/withColumn.ts | ||
var import_plate_common7 = require("@udecode/plate-common"); | ||
// src/lib/normalizers/normalizedColumn.ts | ||
var import_plate_common6 = require("@udecode/plate-common"); | ||
// src/lib/transforms/insertColumnGroup.ts | ||
// src/lib/transforms/insertColumn.ts | ||
var import_plate_common = require("@udecode/plate-common"); | ||
var insertColumnGroup = (editor) => { | ||
(0, import_plate_common.withoutNormalizing)(editor, () => { | ||
(0, import_plate_common.insertNodes)(editor, { | ||
children: [ | ||
{ | ||
children: [ | ||
{ children: [{ text: "" }], type: import_plate_common.BaseParagraphPlugin.key } | ||
], | ||
type: BaseColumnItemPlugin.key, | ||
width: "50%" | ||
}, | ||
{ | ||
children: [ | ||
{ children: [{ text: "" }], type: import_plate_common.BaseParagraphPlugin.key } | ||
], | ||
type: BaseColumnItemPlugin.key, | ||
width: "50%" | ||
} | ||
], | ||
layout: [50, 50], | ||
type: BaseColumnPlugin.key | ||
}); | ||
}); | ||
}; | ||
// src/lib/transforms/insertEmptyColumn.ts | ||
var import_plate_common2 = require("@udecode/plate-common"); | ||
var insertEmptyColumn = (editor, options) => { | ||
const width = (options == null ? void 0 : options.width) || "33%"; | ||
(0, import_plate_common2.insertNodes)( | ||
var insertColumn = (editor, _a = {}) => { | ||
var _b = _a, { width = "33%" } = _b, options = __objRest(_b, ["width"]); | ||
(0, import_plate_common.insertNodes)( | ||
editor, | ||
{ | ||
children: [{ children: [{ text: "" }], type: import_plate_common2.BaseParagraphPlugin.key }], | ||
children: [editor.api.create.block()], | ||
type: BaseColumnItemPlugin.key, | ||
width | ||
}, | ||
(0, import_plate_common2.getQueryOptions)(editor, options) | ||
options | ||
); | ||
}; | ||
// src/lib/transforms/insertColumnGroup.ts | ||
var import_plate_common2 = require("@udecode/plate-common"); | ||
var insertColumnGroup = (editor, _a = {}) => { | ||
var _b = _a, { | ||
layout = 2, | ||
select: selectProp | ||
} = _b, options = __objRest(_b, [ | ||
"layout", | ||
"select" | ||
]); | ||
const columnLayout = Array.isArray(layout) ? layout : Array(layout).fill(Math.floor(100 / layout)); | ||
(0, import_plate_common2.withoutNormalizing)(editor, () => { | ||
(0, import_plate_common2.insertNodes)( | ||
editor, | ||
{ | ||
children: columnLayout.map((width) => ({ | ||
children: [editor.api.create.block()], | ||
type: BaseColumnItemPlugin.key, | ||
width: `${width}%` | ||
})), | ||
layout: columnLayout, | ||
type: BaseColumnPlugin.key | ||
}, | ||
options | ||
); | ||
if (selectProp) { | ||
const entry = (0, import_plate_common2.findNode)(editor, { | ||
at: options.at, | ||
match: { type: editor.getType(BaseColumnPlugin) } | ||
}); | ||
if (!entry) return; | ||
(0, import_plate_common2.select)(editor, entry[1].concat([0])); | ||
} | ||
}); | ||
}; | ||
// src/lib/transforms/moveMiddleColumn.ts | ||
@@ -133,76 +152,86 @@ var import_plate_common3 = require("@udecode/plate-common"); | ||
// src/lib/transforms/toggleColumns.ts | ||
// src/lib/transforms/toggleColumnGroup.ts | ||
var import_plate_common5 = require("@udecode/plate-common"); | ||
var toggleColumns = (editor, nodeEntry) => { | ||
var toggleColumnGroup = (editor, { | ||
at, | ||
layout = 2 | ||
} = {}) => { | ||
const entry = (0, import_plate_common5.getBlockAbove)(editor, { at }); | ||
if (!entry) return; | ||
const [node] = entry; | ||
const columnLayout = Array.isArray(layout) ? layout : Array(layout).fill(Math.floor(100 / layout)); | ||
const nodes = { | ||
children: [ | ||
{ | ||
children: [nodeEntry[0]], | ||
type: BaseColumnItemPlugin.key, | ||
width: "33.33%" | ||
}, | ||
{ | ||
children: [{ text: "" }], | ||
type: BaseColumnItemPlugin.key, | ||
width: "33.33%" | ||
}, | ||
{ | ||
children: [{ text: "" }], | ||
type: BaseColumnItemPlugin.key, | ||
width: "33.33%" | ||
} | ||
], | ||
children: columnLayout.map((width, index) => ({ | ||
children: [index === 0 ? node : editor.api.create.block()], | ||
type: BaseColumnItemPlugin.key, | ||
width: `${width}%` | ||
})), | ||
layout: columnLayout, | ||
type: BaseColumnPlugin.key | ||
}; | ||
(0, import_plate_common5.replaceNode)(editor, { | ||
at: nodeEntry[1], | ||
at: entry[1], | ||
nodes | ||
}); | ||
(0, import_plate_common5.select)(editor, (0, import_plate_common5.getStartPoint)(editor, entry[1].concat([0]))); | ||
}; | ||
// src/lib/normalizers/normalizedColumn.ts | ||
var normalizeColumn = (editor) => { | ||
const { normalizeNode } = editor; | ||
return function(entry) { | ||
if ((0, import_plate_common6.isElement)(entry[0]) && entry[0].type === BaseColumnPlugin.key) { | ||
return normalizeColumnHelper( | ||
editor, | ||
entry | ||
); | ||
// src/lib/withColumn.ts | ||
var withColumn = ({ editor }) => { | ||
const { deleteBackward, isEmpty, normalizeNode } = editor; | ||
editor.normalizeNode = (entry) => { | ||
const [n, path] = entry; | ||
if ((0, import_plate_common6.isElement)(n) && n.type === BaseColumnPlugin.key) { | ||
const node = n; | ||
if (!node.children.some( | ||
(child) => (0, import_plate_common6.isElement)(child) && child.type === editor.getType(BaseColumnItemPlugin) | ||
)) { | ||
(0, import_plate_common6.removeNodes)(editor, { at: path }); | ||
return; | ||
} | ||
if (node.children.length < 2) { | ||
editor.withoutNormalizing(() => { | ||
(0, import_plate_common6.unwrapNodes)(editor, { at: path }); | ||
(0, import_plate_common6.unwrapNodes)(editor, { at: path }); | ||
}); | ||
return; | ||
} | ||
const prevChildrenCnt = node.children.length; | ||
const currentLayout = node.layout; | ||
if (currentLayout) { | ||
const currentChildrenCnt = currentLayout.length; | ||
const groupPathRef = (0, import_plate_common6.createPathRef)(editor, path); | ||
if (prevChildrenCnt === 2 && currentChildrenCnt === 3) { | ||
const lastChildPath = (0, import_plate_common6.getLastChildPath)(entry); | ||
insertColumn(editor, { | ||
at: lastChildPath | ||
}); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
return; | ||
} | ||
if (prevChildrenCnt === 3 && currentChildrenCnt === 2) { | ||
moveMiddleColumn(editor, entry, { direction: "left" }); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
return; | ||
} | ||
if (prevChildrenCnt === currentChildrenCnt) { | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
return; | ||
} | ||
} | ||
} | ||
if ((0, import_plate_common6.isElement)(n) && n.type === BaseColumnItemPlugin.key) { | ||
const node = n; | ||
if (node.children.length === 0) { | ||
(0, import_plate_common6.removeNodes)(editor, { at: path }); | ||
return; | ||
} | ||
} | ||
return normalizeNode(entry); | ||
}; | ||
}; | ||
var normalizeColumnHelper = (editor, entry) => { | ||
const [node, path] = entry; | ||
const prevChildrenCnt = node.children.length; | ||
const currentLayout = node.layout; | ||
if (!currentLayout) return; | ||
const currentChildrenCnt = currentLayout.length; | ||
const groupPathRef = (0, import_plate_common6.createPathRef)(editor, path); | ||
if (prevChildrenCnt === 2 && currentChildrenCnt === 3) { | ||
const lastChildPath = (0, import_plate_common6.getLastChildPath)(entry); | ||
insertEmptyColumn(editor, { | ||
at: lastChildPath | ||
}); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
} | ||
if (prevChildrenCnt === 3 && currentChildrenCnt === 2) { | ||
moveMiddleColumn(editor, entry, { direction: "left" }); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
} | ||
if (prevChildrenCnt === currentChildrenCnt) { | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
} | ||
}; | ||
// src/lib/withColumn.ts | ||
var withColumn = ({ editor }) => { | ||
const { deleteBackward, isEmpty } = editor; | ||
editor.normalizeNode = normalizeColumn(editor); | ||
editor.deleteBackward = (unit) => { | ||
var _a; | ||
if ((0, import_plate_common7.isCollapsed)(editor.selection)) { | ||
const entry = (0, import_plate_common7.getAboveNode)(editor, { | ||
match: (n) => (0, import_plate_common7.isElement)(n) && n.type === BaseColumnItemPlugin.key | ||
if ((0, import_plate_common6.isCollapsed)(editor.selection)) { | ||
const entry = (0, import_plate_common6.getAboveNode)(editor, { | ||
match: (n) => (0, import_plate_common6.isElement)(n) && n.type === BaseColumnItemPlugin.key | ||
}); | ||
@@ -212,3 +241,3 @@ if (entry) { | ||
if (node.children.length > 1) return deleteBackward(unit); | ||
const isStart = (0, import_plate_common7.isStartPoint)(editor, (_a = editor.selection) == null ? void 0 : _a.anchor, path); | ||
const isStart = (0, import_plate_common6.isStartPoint)(editor, (_a = editor.selection) == null ? void 0 : _a.anchor, path); | ||
if (isStart) return; | ||
@@ -229,3 +258,3 @@ } | ||
// src/lib/BaseColumnPlugin.ts | ||
var BaseColumnItemPlugin = (0, import_plate_common8.createSlatePlugin)({ | ||
var BaseColumnItemPlugin = (0, import_plate_common7.createSlatePlugin)({ | ||
key: "column", | ||
@@ -235,3 +264,3 @@ extendEditor: withColumn, | ||
}); | ||
var BaseColumnPlugin = (0, import_plate_common8.createSlatePlugin)({ | ||
var BaseColumnPlugin = (0, import_plate_common7.createSlatePlugin)({ | ||
key: "column_group", | ||
@@ -245,10 +274,9 @@ node: { isElement: true }, | ||
BaseColumnPlugin, | ||
insertColumn, | ||
insertColumnGroup, | ||
insertEmptyColumn, | ||
moveMiddleColumn, | ||
normalizeColumn, | ||
setColumnWidth, | ||
toggleColumns, | ||
toggleColumnGroup, | ||
withColumn | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,17 @@ "use strict"; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __objRest = (source, exclude) => { | ||
var target = {}; | ||
for (var prop in source) | ||
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
target[prop] = source[prop]; | ||
if (source != null && __getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(source)) { | ||
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
target[prop] = source[prop]; | ||
} | ||
return target; | ||
}; | ||
var __export = (target, all) => { | ||
@@ -36,22 +50,19 @@ for (var name in all) | ||
// src/lib/BaseColumnPlugin.ts | ||
var import_plate_common6 = require("@udecode/plate-common"); | ||
var import_plate_common5 = require("@udecode/plate-common"); | ||
// src/lib/withColumn.ts | ||
var import_plate_common5 = require("@udecode/plate-common"); | ||
// src/lib/normalizers/normalizedColumn.ts | ||
var import_plate_common4 = require("@udecode/plate-common"); | ||
// src/lib/transforms/insertEmptyColumn.ts | ||
// src/lib/transforms/insertColumn.ts | ||
var import_plate_common = require("@udecode/plate-common"); | ||
var insertEmptyColumn = (editor, options) => { | ||
const width = (options == null ? void 0 : options.width) || "33%"; | ||
var insertColumn = (editor, _a = {}) => { | ||
var _b = _a, { width = "33%" } = _b, options = __objRest(_b, ["width"]); | ||
(0, import_plate_common.insertNodes)( | ||
editor, | ||
{ | ||
children: [{ children: [{ text: "" }], type: import_plate_common.BaseParagraphPlugin.key }], | ||
children: [editor.api.create.block()], | ||
type: BaseColumnItemPlugin.key, | ||
width | ||
}, | ||
(0, import_plate_common.getQueryOptions)(editor, options) | ||
options | ||
); | ||
@@ -104,47 +115,60 @@ }; | ||
// src/lib/normalizers/normalizedColumn.ts | ||
var normalizeColumn = (editor) => { | ||
const { normalizeNode } = editor; | ||
return function(entry) { | ||
if ((0, import_plate_common4.isElement)(entry[0]) && entry[0].type === BaseColumnPlugin.key) { | ||
return normalizeColumnHelper( | ||
editor, | ||
entry | ||
); | ||
// src/lib/withColumn.ts | ||
var withColumn = ({ editor }) => { | ||
const { deleteBackward, isEmpty, normalizeNode } = editor; | ||
editor.normalizeNode = (entry) => { | ||
const [n, path] = entry; | ||
if ((0, import_plate_common4.isElement)(n) && n.type === BaseColumnPlugin.key) { | ||
const node = n; | ||
if (!node.children.some( | ||
(child) => (0, import_plate_common4.isElement)(child) && child.type === editor.getType(BaseColumnItemPlugin) | ||
)) { | ||
(0, import_plate_common4.removeNodes)(editor, { at: path }); | ||
return; | ||
} | ||
if (node.children.length < 2) { | ||
editor.withoutNormalizing(() => { | ||
(0, import_plate_common4.unwrapNodes)(editor, { at: path }); | ||
(0, import_plate_common4.unwrapNodes)(editor, { at: path }); | ||
}); | ||
return; | ||
} | ||
const prevChildrenCnt = node.children.length; | ||
const currentLayout = node.layout; | ||
if (currentLayout) { | ||
const currentChildrenCnt = currentLayout.length; | ||
const groupPathRef = (0, import_plate_common4.createPathRef)(editor, path); | ||
if (prevChildrenCnt === 2 && currentChildrenCnt === 3) { | ||
const lastChildPath = (0, import_plate_common4.getLastChildPath)(entry); | ||
insertColumn(editor, { | ||
at: lastChildPath | ||
}); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
return; | ||
} | ||
if (prevChildrenCnt === 3 && currentChildrenCnt === 2) { | ||
moveMiddleColumn(editor, entry, { direction: "left" }); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
return; | ||
} | ||
if (prevChildrenCnt === currentChildrenCnt) { | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
return; | ||
} | ||
} | ||
} | ||
if ((0, import_plate_common4.isElement)(n) && n.type === BaseColumnItemPlugin.key) { | ||
const node = n; | ||
if (node.children.length === 0) { | ||
(0, import_plate_common4.removeNodes)(editor, { at: path }); | ||
return; | ||
} | ||
} | ||
return normalizeNode(entry); | ||
}; | ||
}; | ||
var normalizeColumnHelper = (editor, entry) => { | ||
const [node, path] = entry; | ||
const prevChildrenCnt = node.children.length; | ||
const currentLayout = node.layout; | ||
if (!currentLayout) return; | ||
const currentChildrenCnt = currentLayout.length; | ||
const groupPathRef = (0, import_plate_common4.createPathRef)(editor, path); | ||
if (prevChildrenCnt === 2 && currentChildrenCnt === 3) { | ||
const lastChildPath = (0, import_plate_common4.getLastChildPath)(entry); | ||
insertEmptyColumn(editor, { | ||
at: lastChildPath | ||
}); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
} | ||
if (prevChildrenCnt === 3 && currentChildrenCnt === 2) { | ||
moveMiddleColumn(editor, entry, { direction: "left" }); | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
} | ||
if (prevChildrenCnt === currentChildrenCnt) { | ||
setColumnWidth(editor, groupPathRef, currentLayout); | ||
} | ||
}; | ||
// src/lib/withColumn.ts | ||
var withColumn = ({ editor }) => { | ||
const { deleteBackward, isEmpty } = editor; | ||
editor.normalizeNode = normalizeColumn(editor); | ||
editor.deleteBackward = (unit) => { | ||
var _a; | ||
if ((0, import_plate_common5.isCollapsed)(editor.selection)) { | ||
const entry = (0, import_plate_common5.getAboveNode)(editor, { | ||
match: (n) => (0, import_plate_common5.isElement)(n) && n.type === BaseColumnItemPlugin.key | ||
if ((0, import_plate_common4.isCollapsed)(editor.selection)) { | ||
const entry = (0, import_plate_common4.getAboveNode)(editor, { | ||
match: (n) => (0, import_plate_common4.isElement)(n) && n.type === BaseColumnItemPlugin.key | ||
}); | ||
@@ -154,3 +178,3 @@ if (entry) { | ||
if (node.children.length > 1) return deleteBackward(unit); | ||
const isStart = (0, import_plate_common5.isStartPoint)(editor, (_a = editor.selection) == null ? void 0 : _a.anchor, path); | ||
const isStart = (0, import_plate_common4.isStartPoint)(editor, (_a = editor.selection) == null ? void 0 : _a.anchor, path); | ||
if (isStart) return; | ||
@@ -171,3 +195,3 @@ } | ||
// src/lib/BaseColumnPlugin.ts | ||
var BaseColumnItemPlugin = (0, import_plate_common6.createSlatePlugin)({ | ||
var BaseColumnItemPlugin = (0, import_plate_common5.createSlatePlugin)({ | ||
key: "column", | ||
@@ -177,3 +201,3 @@ extendEditor: withColumn, | ||
}); | ||
var BaseColumnPlugin = (0, import_plate_common6.createSlatePlugin)({ | ||
var BaseColumnPlugin = (0, import_plate_common5.createSlatePlugin)({ | ||
key: "column_group", | ||
@@ -185,3 +209,3 @@ node: { isElement: true }, | ||
// src/react/onKeyDownColumn.ts | ||
var import_plate_common7 = require("@udecode/plate-common"); | ||
var import_plate_common6 = require("@udecode/plate-common"); | ||
var import_slate2 = require("slate"); | ||
@@ -191,5 +215,5 @@ var onKeyDownColumn = ({ editor, event }) => { | ||
const at = editor.selection; | ||
if ((0, import_plate_common7.isHotkey)("mod+a", event) && at) { | ||
const aboveNode = (0, import_plate_common7.getAboveNode)(editor); | ||
const ancestorNode = (0, import_plate_common7.getAncestorNode)(editor); | ||
if ((0, import_plate_common6.isHotkey)("mod+a", event) && at) { | ||
const aboveNode = (0, import_plate_common6.getAboveNode)(editor); | ||
const ancestorNode = (0, import_plate_common6.getAncestorNode)(editor); | ||
if (!ancestorNode) return; | ||
@@ -201,7 +225,7 @@ if (!aboveNode) return; | ||
let targetPath = import_slate2.Path.parent(abovePath); | ||
if ((0, import_plate_common7.isSelectionCoverBlock)(editor)) { | ||
if ((0, import_plate_common6.isSelectionCoverBlock)(editor)) { | ||
targetPath = import_slate2.Path.parent(targetPath); | ||
} | ||
if (targetPath.length === 0) return; | ||
(0, import_plate_common7.select)(editor, targetPath); | ||
(0, import_plate_common6.select)(editor, targetPath); | ||
event.preventDefault(); | ||
@@ -222,3 +246,3 @@ event.stopPropagation(); | ||
// src/react/column-store.ts | ||
var import_plate_common8 = require("@udecode/plate-common"); | ||
var import_plate_common7 = require("@udecode/plate-common"); | ||
var import_react2 = require("@udecode/plate-common/react"); | ||
@@ -230,15 +254,15 @@ var useColumnState = () => { | ||
const setDoubleColumn = () => { | ||
(0, import_plate_common8.setNodes)(editor, { layout: [50, 50] }, { at: columnPath }); | ||
(0, import_plate_common7.setNodes)(editor, { layout: [50, 50] }, { at: columnPath }); | ||
}; | ||
const setThreeColumn = () => { | ||
(0, import_plate_common8.setNodes)(editor, { layout: [33, 33, 33] }, { at: columnPath }); | ||
(0, import_plate_common7.setNodes)(editor, { layout: [33, 33, 33] }, { at: columnPath }); | ||
}; | ||
const setRightSideDoubleColumn = () => { | ||
(0, import_plate_common8.setNodes)(editor, { layout: [70, 30] }, { at: columnPath }); | ||
(0, import_plate_common7.setNodes)(editor, { layout: [70, 30] }, { at: columnPath }); | ||
}; | ||
const setLeftSideDoubleColumn = () => { | ||
(0, import_plate_common8.setNodes)(editor, { layout: [30, 70] }, { at: columnPath }); | ||
(0, import_plate_common7.setNodes)(editor, { layout: [30, 70] }, { at: columnPath }); | ||
}; | ||
const setDoubleSideDoubleColumn = () => { | ||
(0, import_plate_common8.setNodes)(editor, { layout: [25, 50, 25] }, { at: columnPath }); | ||
(0, import_plate_common7.setNodes)(editor, { layout: [25, 50, 25] }, { at: columnPath }); | ||
}; | ||
@@ -255,3 +279,3 @@ return { | ||
// src/react/hooks/useDebouncePopoverOpen.ts | ||
var import_plate_common9 = require("@udecode/plate-common"); | ||
var import_plate_common8 = require("@udecode/plate-common"); | ||
var import_react3 = require("@udecode/plate-common/react"); | ||
@@ -263,3 +287,3 @@ var import_slate_react = require("slate-react"); | ||
const selectionCollapsed = (0, import_react3.useEditorSelector)( | ||
(editor) => (0, import_plate_common9.isCollapsed)(editor.selection), | ||
(editor) => (0, import_plate_common8.isCollapsed)(editor.selection), | ||
[] | ||
@@ -266,0 +290,0 @@ ); |
{ | ||
"name": "@udecode/plate-layout", | ||
"version": "39.0.0", | ||
"version": "40.0.0", | ||
"description": "Layout plugin for Plate", | ||
@@ -56,9 +56,10 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@udecode/plate-common": ">=39.0.0", | ||
"@udecode/plate-common": ">=40.0.0", | ||
"react": ">=16.8.0", | ||
"react-dom": ">=16.8.0", | ||
"slate": ">=0.103.0", | ||
"slate-dom": ">=0.111.0", | ||
"slate-history": ">=0.93.0", | ||
"slate-hyperscript": ">=0.66.0", | ||
"slate-react": ">=0.108.0" | ||
"slate-react": ">=0.111.0" | ||
}, | ||
@@ -65,0 +66,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
104688
1126
8