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

@milkdown/prose

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@milkdown/prose - npm Package Compare versions

Comparing version 7.2.2 to 7.2.3

src/toolkit/commands/index.ts

38

./lib/index.js

@@ -1,2 +0,2 @@

import { PluginKey, Plugin, NodeSelection } from 'prosemirror-state';
import { PluginKey, Plugin, NodeSelection, AllSelection } from 'prosemirror-state';
import { InputRule } from 'prosemirror-inputrules';

@@ -288,3 +288,37 @@ import { expectDomTypeError, missingRootElement, getAtomFromSchemaFail } from '@milkdown/exception';

export { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect };
const toggleMarkdownMark = (markType, mark) => {
return (state, dispatch) => {
var _a;
const { tr, selection } = state;
const { from, to, $cursor, ranges } = selection;
const cursorMarks = (_a = $cursor == null ? void 0 : $cursor.marks()) != null ? _a : [];
if ($cursor) {
if (markType.isInSet(state.storedMarks || cursorMarks)) {
dispatch == null ? void 0 : dispatch(tr.removeStoredMark(markType));
return true;
}
dispatch == null ? void 0 : dispatch(tr.addStoredMark(markType.create()));
return true;
}
let has = false;
for (let i = 0; !has && i < ranges.length; i++) {
const { $from, $to } = ranges[i];
has = state.doc.rangeHasMark($from.pos, $to.pos, markType);
}
if (has) {
for (let i = 0; i < ranges.length; i++) {
const { $from, $to } = ranges[i];
tr.removeMark($from.pos, $to.pos, markType);
}
dispatch == null ? void 0 : dispatch(tr.scrollIntoView());
return true;
}
if (selection instanceof AllSelection)
return false;
dispatch == null ? void 0 : dispatch(tr.insertText(mark, from).insertText(mark, to + mark.length).scrollIntoView());
return true;
};
};
export { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect, toggleMarkdownMark };
//# sourceMappingURL=index.js.map

6

lib/index.d.ts
import { InputRule } from 'prosemirror-inputrules';
import { PluginKey, Plugin, Transaction, Selection } from 'prosemirror-state';
import { PluginKey, Plugin, Transaction, Selection, Command } from 'prosemirror-state';
import { MarkType, NodeType, Node, Schema, ResolvedPos } from 'prosemirror-model';

@@ -92,3 +92,5 @@ import { EditorView } from 'prosemirror-view';

export { ContentNodeWithPos, NodeWithPos, browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect };
declare const toggleMarkdownMark: (markType: MarkType, mark: string) => Command;
export { ContentNodeWithPos, NodeWithPos, browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect, toggleMarkdownMark };
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import { PluginKey, Plugin, NodeSelection } from 'prosemirror-state';
import { PluginKey, Plugin, NodeSelection, AllSelection } from 'prosemirror-state';
import { InputRule } from 'prosemirror-inputrules';

@@ -288,3 +288,37 @@ import { expectDomTypeError, missingRootElement, getAtomFromSchemaFail } from '@milkdown/exception';

export { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect };
const toggleMarkdownMark = (markType, mark) => {
return (state, dispatch) => {
var _a;
const { tr, selection } = state;
const { from, to, $cursor, ranges } = selection;
const cursorMarks = (_a = $cursor == null ? void 0 : $cursor.marks()) != null ? _a : [];
if ($cursor) {
if (markType.isInSet(state.storedMarks || cursorMarks)) {
dispatch == null ? void 0 : dispatch(tr.removeStoredMark(markType));
return true;
}
dispatch == null ? void 0 : dispatch(tr.addStoredMark(markType.create()));
return true;
}
let has = false;
for (let i = 0; !has && i < ranges.length; i++) {
const { $from, $to } = ranges[i];
has = state.doc.rangeHasMark($from.pos, $to.pos, markType);
}
if (has) {
for (let i = 0; i < ranges.length; i++) {
const { $from, $to } = ranges[i];
tr.removeMark($from.pos, $to.pos, markType);
}
dispatch == null ? void 0 : dispatch(tr.scrollIntoView());
return true;
}
if (selection instanceof AllSelection)
return false;
dispatch == null ? void 0 : dispatch(tr.insertText(mark, from).insertText(mark, to + mark.length).scrollIntoView());
return true;
};
};
export { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect, toggleMarkdownMark };
//# sourceMappingURL=index.js.map
{
"name": "@milkdown/prose",
"type": "module",
"version": "7.2.2",
"version": "7.2.3",
"license": "MIT",

@@ -133,3 +133,3 @@ "repository": {

"tslib": "^2.5.0",
"@milkdown/exception": "7.2.2"
"@milkdown/exception": "7.2.3"
},

@@ -136,0 +136,0 @@ "nx": {

@@ -6,1 +6,2 @@ /* Copyright 2021, Milkdown by Mirone. */

export * from './prose'
export * from './commands'

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