New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@udecode/plate-indent-list

Package Overview
Dependencies
Maintainers
2
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/plate-indent-list - npm Package Compare versions

Comparing version 31.4.0 to 31.4.3

10

dist/index.d.ts
import * as _udecode_plate_core from '@udecode/plate-core';
import * as _udecode_slate from '@udecode/slate';
import { EElement, Value, TNodeEntry, EElementOrText, TNode, TEditor, EElementEntry, PlateRenderElementProps, TElement, InjectComponentProps, InjectComponentReturnType, ENodeEntry, PlateEditor, WithPlatePlugin, KeyboardHandlerReturnType } from '@udecode/plate-common';
import { TextUnit, Path } from 'slate';
import { TextUnit, NodeEntry, Path } from 'slate';
import { SetIndentOptions } from '@udecode/plate-indent';

@@ -119,4 +119,2 @@

declare const deleteBackwardIndentList: <V extends Value>(editor: PlateEditor<V>) => (unit: TextUnit) => void;
declare const someIndentList: <V extends Value>(editor: PlateEditor<V>, type: string) => boolean;

@@ -154,2 +152,4 @@

declare const deleteBackwardIndentList: <V extends Value>(editor: PlateEditor<V>) => (unit: TextUnit) => void;
/**

@@ -168,2 +168,4 @@ * If there is no previous list item and node list start is defined, unset list start (1).

declare const shouldMergeNodesRemovePrevNodeIndentList: <V extends Value>(editor: PlateEditor<V>) => (prevEntry: NodeEntry, curNodeEntry: NodeEntry) => boolean;
declare const areEqListStyleType: <V extends Value>(editor: TEditor<V>, entries: TNodeEntry[], { listStyleType, }: {

@@ -257,2 +259,2 @@ listStyleType?: string | undefined;

export { type GetIndentListSiblingsOptions, type GetSiblingIndentListOptions, type IndentListOptions, type IndentListPlugin, KEY_LIST_CHECKED, KEY_LIST_RESTART, KEY_LIST_START, KEY_LIST_STYLE_TYPE, KEY_TODO_STYLE_TYPE, type LiFC, ListStyleType, type MarkerFC, ULIST_STYLE_TYPES, areEqListStyleType, createIndentListPlugin, deleteBackwardIndentList, getIndentListSiblings, getNextIndentList, getPreviousIndentList, getSiblingIndentList, getSiblingListStyleType, indentList, indentTodo, injectIndentListComponent, normalizeFirstIndentListStart, normalizeIndentList, normalizeIndentListNotIndented, normalizeIndentListStart, normalizeNextIndentListStart, onKeyDownIndentList, outdentList, setIndentListNode, setIndentListNodes, setIndentListSiblingNodes, setIndentTodoNode, someIndentList, someIndentTodo, toggleIndentList, toggleIndentListSet, toggleIndentListUnset, useIndentListToolbarButton, useIndentListToolbarButtonState, useIndentTodoToolBarButton, useIndentTodoToolBarButtonState, withIndentList };
export { type GetIndentListSiblingsOptions, type GetSiblingIndentListOptions, type IndentListOptions, type IndentListPlugin, KEY_LIST_CHECKED, KEY_LIST_RESTART, KEY_LIST_START, KEY_LIST_STYLE_TYPE, KEY_TODO_STYLE_TYPE, type LiFC, ListStyleType, type MarkerFC, ULIST_STYLE_TYPES, areEqListStyleType, createIndentListPlugin, deleteBackwardIndentList, getIndentListSiblings, getNextIndentList, getPreviousIndentList, getSiblingIndentList, getSiblingListStyleType, indentList, indentTodo, injectIndentListComponent, normalizeFirstIndentListStart, normalizeIndentList, normalizeIndentListNotIndented, normalizeIndentListStart, normalizeNextIndentListStart, onKeyDownIndentList, outdentList, setIndentListNode, setIndentListNodes, setIndentListSiblingNodes, setIndentTodoNode, shouldMergeNodesRemovePrevNodeIndentList, someIndentList, someIndentTodo, toggleIndentList, toggleIndentListSet, toggleIndentListUnset, useIndentListToolbarButton, useIndentListToolbarButtonState, useIndentTodoToolBarButton, useIndentTodoToolBarButtonState, withIndentList };

137

dist/index.js

@@ -91,2 +91,3 @@ "use strict";

setIndentTodoNode: () => setIndentTodoNode,
shouldMergeNodesRemovePrevNodeIndentList: () => shouldMergeNodesRemovePrevNodeIndentList,
someIndentList: () => someIndentList,

@@ -106,3 +107,3 @@ someIndentTodo: () => someIndentTodo,

// src/createIndentListPlugin.ts
var import_plate_common17 = require("@udecode/plate-common");
var import_plate_common18 = require("@udecode/plate-common");

@@ -606,38 +607,14 @@ // src/injectIndentListComponent.tsx

// src/withIndentList.ts
var import_plate_common16 = require("@udecode/plate-common");
var import_plate_common17 = require("@udecode/plate-common");
var import_plate_indent9 = require("@udecode/plate-indent");
// src/delete-backward/deleteBackwardIndentList.ts
var import_plate_common11 = require("@udecode/plate-common");
var deleteBackwardIndentList = (editor) => {
const { deleteBackward } = editor;
return function(unit) {
deleteBackwardHelper(editor);
deleteBackward(unit);
};
};
function deleteBackwardHelper(editor) {
if ((0, import_plate_common11.isCollapsed)(editor.selection)) {
const str = (0, import_plate_common11.getNodeString)(editor);
if (str)
return;
const entry = (0, import_plate_common11.getAboveNode)(editor);
if (!entry)
return;
const node = entry[0];
if ((0, import_plate_common11.isDefined)(node[KEY_LIST_STYLE_TYPE])) {
outdentList(editor);
}
}
}
// src/normalizeIndentList.ts
var import_plate_common15 = require("@udecode/plate-common");
var import_plate_common14 = require("@udecode/plate-common");
// src/normalizers/normalizeIndentListNotIndented.ts
var import_plate_common12 = require("@udecode/plate-common");
var import_plate_common11 = require("@udecode/plate-common");
var import_plate_indent8 = require("@udecode/plate-indent");
var normalizeIndentListNotIndented = (editor, [node, path]) => {
if (!(0, import_plate_common12.isDefined)(node[import_plate_indent8.KEY_INDENT]) && (node[KEY_LIST_STYLE_TYPE] || node[KEY_LIST_START])) {
(0, import_plate_common12.unsetNodes)(editor, [KEY_LIST_STYLE_TYPE, KEY_LIST_START], { at: path });
if (!(0, import_plate_common11.isDefined)(node[import_plate_indent8.KEY_INDENT]) && (node[KEY_LIST_STYLE_TYPE] || node[KEY_LIST_START])) {
(0, import_plate_common11.unsetNodes)(editor, [KEY_LIST_STYLE_TYPE, KEY_LIST_START], { at: path });
return true;

@@ -648,9 +625,9 @@ }

// src/normalizers/normalizeIndentListStart.ts
var import_plate_common14 = require("@udecode/plate-common");
var import_plate_common13 = require("@udecode/plate-common");
// src/normalizers/normalizeFirstIndentListStart.ts
var import_plate_common13 = require("@udecode/plate-common");
var import_plate_common12 = require("@udecode/plate-common");
var normalizeFirstIndentListStart = (editor, [node, path]) => {
if ((0, import_plate_common13.isDefined)(node[KEY_LIST_START])) {
(0, import_plate_common13.unsetNodes)(editor, KEY_LIST_START, { at: path });
if ((0, import_plate_common12.isDefined)(node[KEY_LIST_START])) {
(0, import_plate_common12.unsetNodes)(editor, KEY_LIST_START, { at: path });
return true;

@@ -670,3 +647,3 @@ }

if (currListStart !== listStart) {
(0, import_plate_common14.setElements)(editor, { [KEY_LIST_START]: listStart }, { at: path });
(0, import_plate_common13.setElements)(editor, { [KEY_LIST_START]: listStart }, { at: path });
return true;

@@ -677,3 +654,3 @@ }

var normalizeIndentListStart = (editor, entry, options) => {
return (0, import_plate_common14.withoutNormalizing)(editor, () => {
return (0, import_plate_common13.withoutNormalizing)(editor, () => {
const [node] = entry;

@@ -696,3 +673,3 @@ const listStyleType = node[KEY_LIST_STYLE_TYPE];

normalized = true;
prevEntry = [(0, import_plate_common14.getNode)(editor, currEntry[1]), currEntry[1]];
prevEntry = [(0, import_plate_common13.getNode)(editor, currEntry[1]), currEntry[1]];
currEntry = getNextIndentList(editor, currEntry, options);

@@ -710,3 +687,3 @@ if (!currEntry)

return ([node, path]) => {
const normalized = (0, import_plate_common15.withoutNormalizing)(editor, () => {
const normalized = (0, import_plate_common14.withoutNormalizing)(editor, () => {
if (normalizeIndentListNotIndented(editor, [node, path]))

@@ -727,2 +704,34 @@ return true;

// src/normalizers/deleteBackwardIndentList.ts
var import_plate_common15 = require("@udecode/plate-common");
var deleteBackwardIndentList = (editor) => {
const { deleteBackward } = editor;
return function(unit) {
const nodeEntry = (0, import_plate_common15.getAboveNode)(editor);
if (!nodeEntry)
return deleteBackward(unit);
const listNode = nodeEntry[0];
if ((0, import_plate_common15.isCollapsed)(editor.selection) && (0, import_plate_common15.getNodeString)(listNode))
return deleteBackward(unit);
if ((0, import_plate_common15.isDefined)(listNode[KEY_LIST_STYLE_TYPE])) {
return outdentList(editor);
}
return deleteBackward(unit);
};
};
// src/normalizers/shouldMergeNodesRemovePrevNodeIndentList.ts
var import_plate_common16 = require("@udecode/plate-common");
var shouldMergeNodesRemovePrevNodeIndentList = (editor) => {
const { shouldMergeNodesRemovePrevNode } = editor;
return function(prevEntry, curNodeEntry) {
const prevNode = prevEntry[0];
const curNode = curNodeEntry[0];
if ((0, import_plate_common16.isDefined)(curNode[KEY_LIST_STYLE_TYPE]) || (0, import_plate_common16.isDefined)(prevNode[KEY_LIST_STYLE_TYPE])) {
return false;
}
return shouldMergeNodesRemovePrevNode(prevEntry, curNodeEntry);
};
};
// src/withIndentList.ts

@@ -734,2 +743,5 @@ var withIndentList = (editor, { options }) => {

editor.deleteBackward = deleteBackwardIndentList(editor);
if (!!editor.shouldMergeNodesRemovePrevNode) {
editor.shouldMergeNodesRemovePrevNode = shouldMergeNodesRemovePrevNodeIndentList(editor);
}
editor.apply = (operation) => {

@@ -739,3 +751,3 @@ const { path } = operation;

if (operation.type === "set_node") {
nodeBefore = (0, import_plate_common16.getNode)(editor, path);
nodeBefore = (0, import_plate_common17.getNode)(editor, path);
}

@@ -765,3 +777,3 @@ if (operation.type === "insert_node") {

if (operation.type === "merge_node" && operation.properties[KEY_LIST_STYLE_TYPE]) {
const node = (0, import_plate_common16.getNode)(editor, path);
const node = (0, import_plate_common17.getNode)(editor, path);
if (node) {

@@ -774,3 +786,3 @@ const nextNodeEntryBefore = getNextIndentList(

if (nextNodeEntryBefore) {
nextIndentListPathRef = (0, import_plate_common16.createPathRef)(editor, nextNodeEntryBefore[1]);
nextIndentListPathRef = (0, import_plate_common17.createPathRef)(editor, nextNodeEntryBefore[1]);
}

@@ -783,3 +795,3 @@ }

if (properties[KEY_LIST_STYLE_TYPE]) {
const node = (0, import_plate_common16.getNode)(editor, path);
const node = (0, import_plate_common17.getNode)(editor, path);
if (!node)

@@ -795,3 +807,3 @@ return;

if (nextPath) {
const nextNode = (0, import_plate_common16.getNode)(editor, nextPath);
const nextNode = (0, import_plate_common17.getNode)(editor, nextPath);
if (nextNode) {

@@ -812,3 +824,3 @@ normalizeIndentListStart(

if (prevListStyleType && !listStyleType) {
const node = (0, import_plate_common16.getNode)(editor, path);
const node = (0, import_plate_common17.getNode)(editor, path);
if (!node)

@@ -830,3 +842,3 @@ return;

if ((prevListStyleType || listStyleType) && prevListStyleType !== listStyleType) {
const node = (0, import_plate_common16.getNode)(editor, path);
const node = (0, import_plate_common17.getNode)(editor, path);
if (!node)

@@ -862,3 +874,3 @@ return;

if (prevIndent !== indent) {
const node = (0, import_plate_common16.getNode)(editor, path);
const node = (0, import_plate_common17.getNode)(editor, path);
if (!node)

@@ -934,3 +946,3 @@ return;

var KEY_TODO_STYLE_TYPE = "todo";
var createIndentListPlugin = (0, import_plate_common17.createPluginFactory)({
var createIndentListPlugin = (0, import_plate_common18.createPluginFactory)({
key: KEY_LIST_STYLE_TYPE,

@@ -950,3 +962,3 @@ inject: {

pluginsByKey: {
[import_plate_common17.KEY_DESERIALIZE_HTML]: {
[import_plate_common18.KEY_DESERIALIZE_HTML]: {
editor: {

@@ -960,3 +972,3 @@ insertData: {

const { body } = document;
(0, import_plate_common17.traverseHtmlElements)(body, (element) => {
(0, import_plate_common18.traverseHtmlElements)(body, (element) => {
if (element.tagName === "LI") {

@@ -966,3 +978,3 @@ const { childNodes } = element;

childNodes.forEach((child) => {
if ((0, import_plate_common17.isHtmlBlockElement)(child)) {
if ((0, import_plate_common18.isHtmlBlockElement)(child)) {
liChildren.push(...child.childNodes);

@@ -978,3 +990,3 @@ } else {

});
return (0, import_plate_common17.postCleanHtml)(body.innerHTML);
return (0, import_plate_common18.postCleanHtml)(body.innerHTML);
}

@@ -991,3 +1003,3 @@ }

return {
type: (0, import_plate_common17.getPluginType)(editor, import_plate_common17.ELEMENT_DEFAULT),
type: (0, import_plate_common18.getPluginType)(editor, import_plate_common18.ELEMENT_DEFAULT),
listStyleType: (_a = options.getListStyleType) == null ? void 0 : _a.call(options, element),

@@ -1008,5 +1020,5 @@ // gdoc uses aria-level attribute

// src/hooks/someIndentList.ts
var import_plate_common18 = require("@udecode/plate-common");
var import_plate_common19 = require("@udecode/plate-common");
var someIndentList = (editor, type) => {
return !!editor.selection && (0, import_plate_common18.someNode)(editor, {
return !!editor.selection && (0, import_plate_common19.someNode)(editor, {
match: (n) => {

@@ -1023,5 +1035,5 @@ const list = n[KEY_LIST_STYLE_TYPE];

// src/hooks/someIndentTodo.ts
var import_plate_common19 = require("@udecode/plate-common");
var import_plate_common20 = require("@udecode/plate-common");
var someIndentTodo = (editor, type) => {
return (0, import_plate_common19.someNode)(editor, {
return (0, import_plate_common20.someNode)(editor, {
at: editor.selection,

@@ -1037,7 +1049,7 @@ match: (n) => {

// src/hooks/useIndentListToolbarButton.ts
var import_plate_common20 = require("@udecode/plate-common");
var import_plate_common21 = require("@udecode/plate-common");
var useIndentListToolbarButtonState = ({
nodeType = "disc" /* Disc */
} = {}) => {
const pressed = (0, import_plate_common20.useEditorSelector)(
const pressed = (0, import_plate_common21.useEditorSelector)(
(editor) => someIndentList(editor, nodeType),

@@ -1055,3 +1067,3 @@ [nodeType]

}) => {
const editor = (0, import_plate_common20.useEditorRef)();
const editor = (0, import_plate_common21.useEditorRef)();
return {

@@ -1073,7 +1085,7 @@ props: {

// src/hooks/useIndentTodoToolbarButton.ts
var import_plate_common21 = require("@udecode/plate-common");
var import_plate_common22 = require("@udecode/plate-common");
var useIndentTodoToolBarButtonState = ({
nodeType = "disc" /* Disc */
} = {}) => {
const pressed = (0, import_plate_common21.useEditorSelector)(
const pressed = (0, import_plate_common22.useEditorSelector)(
(editor) => someIndentTodo(editor, nodeType),

@@ -1091,3 +1103,3 @@ [nodeType]

}) => {
const editor = (0, import_plate_common21.useEditorRef)();
const editor = (0, import_plate_common22.useEditorRef)();
return {

@@ -1159,2 +1171,3 @@ props: {

setIndentTodoNode,
shouldMergeNodesRemovePrevNodeIndentList,
someIndentList,

@@ -1161,0 +1174,0 @@ someIndentTodo,

{
"name": "@udecode/plate-indent-list",
"version": "31.4.0",
"version": "31.4.3",
"description": "Indent list plugin for Plate",

@@ -5,0 +5,0 @@ "license": "MIT",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc