Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-flat-list

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-flat-list - npm Package Compare versions

Comparing version 0.0.25 to 0.0.26

32

./dist/prosemirror-flat-list.js

@@ -869,2 +869,33 @@ // src/commands/dedent-list.ts

// src/commands/toggle-collapsed.ts
function createToggleCollapsedCommand({
collapsed = void 0,
isToggleable = defaultIsToggleable
} = {}) {
const toggleCollapsed = (state, dispatch) => {
const { $from } = state.selection;
for (let depth = $from.depth; depth >= 0; depth--) {
const node = $from.node(depth);
if (isListNode(node) && isToggleable(node)) {
const pos = $from.before(depth);
const attrs = node.attrs;
dispatch == null ? void 0 : dispatch(
state.tr.setNodeAttribute(
pos,
"collapsed",
collapsed != null ? collapsed : !attrs.collapsed
)
);
return true;
}
}
return false;
};
return toggleCollapsed;
}
function defaultIsToggleable(node) {
const attrs = node.attrs;
return attrs.kind === "toggle" && node.childCount >= 2 && !isListNode(node.firstChild);
}
// src/commands/wrap-in-list.ts

@@ -1194,2 +1225,3 @@ import { NodeRange as NodeRange4 } from "prosemirror-model";

createSplitListCommand,
createToggleCollapsedCommand,
createWrapInListCommand,

@@ -1196,0 +1228,0 @@ defaultAttributesGetter,

@@ -16,2 +16,3 @@ import { Attrs } from 'prosemirror-model';

import { Plugin as Plugin_2 } from 'prosemirror-state';
import { ProsemirrorNode } from '@remirror/core';
import { ResolvedPos } from 'prosemirror-model';

@@ -84,2 +85,9 @@ import { Schema } from 'prosemirror-model';

/**
* @public
*
* Return a command function that toggle the `collapsed` attribute of the list node.
*/
export declare function createToggleCollapsedCommand({ collapsed, isToggleable, }?: ToggleCollapsedProps): Command;
/**
* Returns a command function that wraps the selection in a list with the given

@@ -325,4 +333,18 @@ * type an attributes.

/** @public */
export declare interface ToggleCollapsedProps {
/**
* If this value exists, the command will set the `collapsed` attribute to
* this value instead of toggle it.
*/
collapsed?: boolean;
/**
* An optional function to accept a list node and return whether or not this
* node can toggle its `collapsed` attribute.
*/
isToggleable?: (node: ProsemirrorNode) => boolean;
}
/** @public */
export declare function wrappingListInputRule<T extends Attrs = ListAttributes>(re: RegExp, getAttrs: T | ((matches: RegExpMatchArray) => T)): InputRule;
export { }

@@ -869,2 +869,33 @@ // src/commands/dedent-list.ts

// src/commands/toggle-collapsed.ts
function createToggleCollapsedCommand({
collapsed = void 0,
isToggleable = defaultIsToggleable
} = {}) {
const toggleCollapsed = (state, dispatch) => {
const { $from } = state.selection;
for (let depth = $from.depth; depth >= 0; depth--) {
const node = $from.node(depth);
if (isListNode(node) && isToggleable(node)) {
const pos = $from.before(depth);
const attrs = node.attrs;
dispatch == null ? void 0 : dispatch(
state.tr.setNodeAttribute(
pos,
"collapsed",
collapsed != null ? collapsed : !attrs.collapsed
)
);
return true;
}
}
return false;
};
return toggleCollapsed;
}
function defaultIsToggleable(node) {
const attrs = node.attrs;
return attrs.kind === "toggle" && node.childCount >= 2 && !isListNode(node.firstChild);
}
// src/commands/wrap-in-list.ts

@@ -1194,2 +1225,3 @@ import { NodeRange as NodeRange4 } from "prosemirror-model";

createSplitListCommand,
createToggleCollapsedCommand,
createWrapInListCommand,

@@ -1196,0 +1228,0 @@ defaultAttributesGetter,

2

package.json
{
"name": "prosemirror-flat-list",
"type": "module",
"version": "0.0.25",
"version": "0.0.26",
"description": "Powerful list support for ProseMirror",

@@ -6,0 +6,0 @@ "author": "ocavue <ocavue@gmail.com>",

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