@udecode/plate-indent
Advanced tools
Comparing version 10.5.3 to 11.0.0
# @udecode/plate-indent | ||
## 11.0.0 | ||
## 10.5.3 | ||
@@ -4,0 +6,0 @@ |
import { IndentPlugin } from './types'; | ||
export declare const KEY_INDENT = "indent"; | ||
export declare const createIndentPlugin: <T = {}>(override?: Partial<import("@udecode/plate-core").PlatePlugin<T, IndentPlugin>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<T> | undefined) => import("@udecode/plate-core").PlatePlugin<T, IndentPlugin>; | ||
export declare const createIndentPlugin: <V extends import("@udecode/plate-core").Value, E extends import("@udecode/plate-core").PlateEditor<V> = import("@udecode/plate-core").PlateEditor<V>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<IndentPlugin, V, E>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<V, E> | undefined) => import("@udecode/plate-core").PlatePlugin<IndentPlugin, V, E>; | ||
//# sourceMappingURL=createIndentPlugin.d.ts.map |
import { IndentPlugin } from './types'; | ||
export declare const KEY_TEXT_INDENT = "textIndent"; | ||
export declare const createTextIndentPlugin: <T = {}>(override?: Partial<import("@udecode/plate-core").PlatePlugin<T, IndentPlugin>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<T> | undefined) => import("@udecode/plate-core").PlatePlugin<T, IndentPlugin>; | ||
export declare const createTextIndentPlugin: <V extends import("@udecode/plate-core").Value, E extends import("@udecode/plate-core").PlateEditor<V> = import("@udecode/plate-core").PlateEditor<V>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<IndentPlugin, V, E>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<V, E> | undefined) => import("@udecode/plate-core").PlatePlugin<IndentPlugin, V, E>; | ||
//# sourceMappingURL=createTextIndentPlugin.d.ts.map |
@@ -1,3 +0,2 @@ | ||
import { getPluginInjectProps, getNodes, withoutNormalizing, setNodes, createPluginFactory, getPluginType, ELEMENT_DEFAULT } from '@udecode/plate-core'; | ||
import { Transforms } from 'slate'; | ||
import { getPluginInjectProps, getNodeEntries, withoutNormalizing, unsetNodes, setElements, setNodes, createPluginFactory, getPluginType, ELEMENT_DEFAULT } from '@udecode/plate-core'; | ||
@@ -17,3 +16,3 @@ /** | ||
const _nodes = getNodes(editor, { | ||
const _nodes = getNodeEntries(editor, { | ||
block: true, | ||
@@ -26,5 +25,5 @@ ...getNodesOptions | ||
nodes.forEach(([node, path]) => { | ||
var _node, _setNodesProps; | ||
var _ref, _setNodesProps; | ||
const blockIndent = (_node = node[nodeKey]) !== null && _node !== void 0 ? _node : 0; | ||
const blockIndent = (_ref = node[nodeKey]) !== null && _ref !== void 0 ? _ref : 0; | ||
const newIndent = blockIndent + offset; | ||
@@ -36,7 +35,7 @@ const props = (_setNodesProps = setNodesProps === null || setNodesProps === void 0 ? void 0 : setNodesProps({ | ||
if (newIndent <= 0) { | ||
Transforms.unsetNodes(editor, [nodeKey, ...unsetNodesProps], { | ||
unsetNodes(editor, [nodeKey, ...unsetNodesProps], { | ||
at: path | ||
}); | ||
} else { | ||
setNodes(editor, { | ||
setElements(editor, { | ||
[nodeKey]: newIndent, | ||
@@ -116,3 +115,3 @@ ...props | ||
} else if (element.indent) { | ||
Transforms.unsetNodes(editor, 'indent', { | ||
unsetNodes(editor, 'indent', { | ||
at: path | ||
@@ -119,0 +118,0 @@ }); |
@@ -6,3 +6,2 @@ 'use strict'; | ||
var plateCore = require('@udecode/plate-core'); | ||
var slate = require('slate'); | ||
@@ -22,3 +21,3 @@ /** | ||
const _nodes = plateCore.getNodes(editor, { | ||
const _nodes = plateCore.getNodeEntries(editor, { | ||
block: true, | ||
@@ -31,5 +30,5 @@ ...getNodesOptions | ||
nodes.forEach(([node, path]) => { | ||
var _node, _setNodesProps; | ||
var _ref, _setNodesProps; | ||
const blockIndent = (_node = node[nodeKey]) !== null && _node !== void 0 ? _node : 0; | ||
const blockIndent = (_ref = node[nodeKey]) !== null && _ref !== void 0 ? _ref : 0; | ||
const newIndent = blockIndent + offset; | ||
@@ -41,7 +40,7 @@ const props = (_setNodesProps = setNodesProps === null || setNodesProps === void 0 ? void 0 : setNodesProps({ | ||
if (newIndent <= 0) { | ||
slate.Transforms.unsetNodes(editor, [nodeKey, ...unsetNodesProps], { | ||
plateCore.unsetNodes(editor, [nodeKey, ...unsetNodesProps], { | ||
at: path | ||
}); | ||
} else { | ||
plateCore.setNodes(editor, { | ||
plateCore.setElements(editor, { | ||
[nodeKey]: newIndent, | ||
@@ -121,3 +120,3 @@ ...props | ||
} else if (element.indent) { | ||
slate.Transforms.unsetNodes(editor, 'indent', { | ||
plateCore.unsetNodes(editor, 'indent', { | ||
at: path | ||
@@ -124,0 +123,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { PlateEditor } from '@udecode/plate-core'; | ||
import { PlateEditor, Value } from '@udecode/plate-core'; | ||
import { SetIndentOptions } from './setIndent'; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const indent: (editor: PlateEditor, options?: SetIndentOptions | undefined) => void; | ||
export declare const indent: <V extends Value>(editor: PlateEditor<V>, options?: SetIndentOptions<V> | undefined) => void; | ||
//# sourceMappingURL=indent.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { PlateEditor } from '@udecode/plate-core'; | ||
import { PlateEditor, Value } from '@udecode/plate-core'; | ||
import { SetIndentOptions } from './setIndent'; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const outdent: (editor: PlateEditor, options?: SetIndentOptions | undefined) => void; | ||
export declare const outdent: <V extends Value>(editor: PlateEditor<V>, options?: SetIndentOptions<V> | undefined) => void; | ||
//# sourceMappingURL=outdent.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { AnyObject, EditorNodesOptions, PlateEditor, UnhangRangeOptions } from '@udecode/plate-core'; | ||
export interface SetIndentOptions { | ||
import { AnyObject, EditorNodesOptions, PlateEditor, UnhangRangeOptions, Value } from '@udecode/plate-core'; | ||
export interface SetIndentOptions<V extends Value> { | ||
/** | ||
@@ -10,5 +10,5 @@ * 1 to indent | ||
/** | ||
* getNodes options | ||
* getNodeEntries options | ||
*/ | ||
getNodesOptions?: EditorNodesOptions & UnhangRangeOptions; | ||
getNodesOptions?: EditorNodesOptions<V> & UnhangRangeOptions; | ||
/** | ||
@@ -29,3 +29,3 @@ * Set other props than the indent one. | ||
*/ | ||
export declare const setIndent: (editor: PlateEditor, { offset, getNodesOptions, setNodesProps, unsetNodesProps, }: SetIndentOptions) => void; | ||
export declare const setIndent: <V extends Value>(editor: PlateEditor<V>, { offset, getNodesOptions, setNodesProps, unsetNodesProps, }: SetIndentOptions<V>) => void; | ||
//# sourceMappingURL=setIndent.d.ts.map |
@@ -0,1 +1,5 @@ | ||
import { TElement } from '@udecode/plate-core'; | ||
export interface TIndentElement extends TElement { | ||
indent: number; | ||
} | ||
export declare type IndentPlugin = { | ||
@@ -2,0 +6,0 @@ /** |
@@ -7,3 +7,3 @@ import { WithOverride } from '@udecode/plate-core'; | ||
*/ | ||
export declare const withIndent: WithOverride<{}, IndentPlugin>; | ||
export declare const withIndent: WithOverride<IndentPlugin>; | ||
//# sourceMappingURL=withIndent.d.ts.map |
{ | ||
"name": "@udecode/plate-indent", | ||
"version": "10.5.3", | ||
"version": "11.0.0", | ||
"description": "Indent plugin for Plate", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@udecode/plate-core": "10.5.3" | ||
"@udecode/plate-core": "11.0.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "peerDependencies": { |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41352
434
+ Added@udecode/plate-core@11.0.0(transitive)
+ Added@udecode/zustood@1.1.3(transitive)
+ Addedclsx@1.2.1(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addedimmer@9.0.21(transitive)
+ Addedjotai@1.13.1(transitive)
+ Addedproxy-compare@2.6.0(transitive)
+ Addedreact-tracked@1.7.14(transitive)
+ Addeduse-context-selector@1.4.4(transitive)
+ Addeduse-deep-compare@1.3.0(transitive)
+ Addedzustand@3.7.2(transitive)
- Removed@udecode/plate-core@10.5.3(transitive)
- Removed@udecode/zustood@0.4.4(transitive)
- Removedclsx@1.1.1(transitive)
- Removeddequal@1.0.0(transitive)
- Removedimmer@9.0.6(transitive)
- Removedjotai@1.5.3(transitive)
- Removeduse-deep-compare@1.1.0(transitive)
- Removedzustand@3.7.0(transitive)
Updated@udecode/plate-core@11.0.0