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

@prosekit/core

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prosekit/core - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

73

dist/_tsup-dts-rollup.d.ts

@@ -44,3 +44,5 @@ import { AllSelection } from '@prosekit/pm/state';

/**
* Add the given mark to the inline content.
* Returns a command that adds the given mark with the given attributes.
*
* @public
*/

@@ -245,2 +247,7 @@ declare function addMark(options: {

}];
setNodeAttrs: [options: {
type: string | NodeType_2;
attrs: Attrs_2;
pos?: number | undefined;
}];
selectAll: [];

@@ -753,2 +760,8 @@ addMark: [options: {

/**
* Returns a command that inserts the given node at the current selection or at
* the given position.
*
* @public
*/
declare function insertNode(options: {

@@ -773,2 +786,7 @@ node: ProseMirrorNode;

/**
* Returns a command that inserts the given text.
*
* @public
*/
export declare function insertText({ text, from, to, }: {

@@ -1118,3 +1136,5 @@ text: string;

/**
* Remove the given mark from the inline content.
* Returns a command that removes the given mark.
*
* @public
*/

@@ -1146,2 +1166,7 @@ declare function removeMark(options: {

/**
* Returns a command that selects the whole document.
*
* @public
*/
export declare function selectAll(): Command;

@@ -1165,2 +1190,4 @@

* type with the given attributes.
*
* @public
*/

@@ -1176,2 +1203,27 @@ declare function setBlockType(options: {

/**
* Returns a command that set the attributes of the current node.
*
* @public
*/
declare function setNodeAttrs(options: {
/**
* The type of node to set the attributes of.
*
* If current node is not of this type, the command will do nothing.
*/
type: string | NodeType;
/**
* The attributes to set.
*/
attrs: Attrs;
/**
* The position of the node. Defaults to the position of the wrapping node
* containing the current selection.
*/
pos?: number;
}): Command;
export { setNodeAttrs }
export { setNodeAttrs as setNodeAttrs_alias_1 }
export declare function setSelectionAround(tr: Transaction, pos: number): void;

@@ -1242,2 +1294,7 @@

/**
* Returns a command that toggles the given mark with the given attributes.
*
* @public
*/
declare function toggleMark({ type, attrs, }: {

@@ -1250,2 +1307,8 @@ type: string | MarkType;

/**
* Returns a command that set the selected textblocks to the given node type
* with the given attributes.
*
* @public
*/
declare function toggleNode({ type, attrs, }: {

@@ -1330,2 +1393,8 @@ type: string | NodeType;

/**
* Returns a command that wraps the selected textblock with the given node type
* with the given attributes.
*
* @public
*/
export declare function wrap({ nodeType, attrs, }: {

@@ -1332,0 +1401,0 @@ nodeType: NodeType;

@@ -5,2 +5,3 @@ export { addMark } from './_tsup-dts-rollup';

export { setBlockType } from './_tsup-dts-rollup';
export { setNodeAttrs } from './_tsup-dts-rollup';
export { toggleMark } from './_tsup-dts-rollup';

@@ -7,0 +8,0 @@ export { toggleNode } from './_tsup-dts-rollup';

@@ -164,2 +164,25 @@ // src/commands/add-mark.ts

// src/commands/set-node-attrs.ts
function setNodeAttrs(options) {
return (state, dispatch) => {
var _a;
const nodeType = getNodeType(state.schema, options.type);
const pos = (_a = options.pos) != null ? _a : state.selection.$from.before();
const node = state.doc.nodeAt(pos);
if (!node || node.type !== nodeType) {
return false;
}
if (dispatch) {
const { tr } = state;
for (const [key, value] of Object.entries(options.attrs)) {
if (value !== void 0) {
tr.setNodeAttribute(pos, key, value);
}
}
dispatch(tr);
}
return true;
};
}
// src/commands/toggle-mark.ts

@@ -1131,2 +1154,3 @@ import { toggleMark as baseToggleMark } from "@prosekit/pm/commands";

setBlockType,
setNodeAttrs,
selectAll,

@@ -1756,2 +1780,3 @@ addMark,

setBlockType,
setNodeAttrs,
stateFromJSON,

@@ -1758,0 +1783,0 @@ toggleMark,

2

package.json
{
"name": "@prosekit/core",
"type": "module",
"version": "0.2.5",
"version": "0.2.6",
"private": false,

@@ -6,0 +6,0 @@ "author": {

@@ -5,2 +5,3 @@ export { addMark } from './commands/add-mark'

export { setBlockType } from './commands/set-block-type'
export { setNodeAttrs } from './commands/set-node-attrs'
export { toggleMark } from './commands/toggle-mark'

@@ -7,0 +8,0 @@ export { toggleNode } from './commands/toggle-node'

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