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

@chatwoot/prosemirror-schema

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chatwoot/prosemirror-schema - npm Package Compare versions

Comparing version 1.0.15 to 1.0.16

2

package.json
{
"name": "@chatwoot/prosemirror-schema",
"version": "1.0.15",
"version": "1.0.16",
"description": "Schema setup for using prosemirror in chatwoot. Based on 👉 https://github.com/ProseMirror/prosemirror-example-setup/",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -61,92 +61,94 @@ /**

onKeyDown = () => false,
}) => new Plugin({
key: new PluginKey('mentions'),
}) => {
return new Plugin({
key: new PluginKey('mentions'),
view() {
return {
update: (view, prevState) => {
const prev = this.key.getState(prevState);
const next = this.key.getState(view.state);
view() {
return {
update: (view, prevState) => {
const prev = this.key.getState(prevState);
const next = this.key.getState(view.state);
const moved =
const moved =
prev.active && next.active && prev.range.from !== next.range.from;
const started = !prev.active && next.active;
const stopped = prev.active && !next.active;
const changed = !started && !stopped && prev.text !== next.text;
const started = !prev.active && next.active;
const stopped = prev.active && !next.active;
const changed = !started && !stopped && prev.text !== next.text;
if (stopped || moved)
onExit({ view, range: prev.range, text: prev.text });
if (changed && !moved)
onChange({ view, range: next.range, text: next.text });
if (started || moved)
onEnter({ view, range: next.range, text: next.text });
},
};
},
state: {
init() {
return {
active: false,
range: {},
text: null,
if (stopped || moved)
onExit({ view, range: prev.range, text: prev.text });
if (changed && !moved)
onChange({ view, range: next.range, text: next.text });
if (started || moved)
onEnter({ view, range: next.range, text: next.text });
},
};
},
apply(tr, prev) {
const { selection } = tr;
const next = { ...prev };
state: {
init() {
return {
active: false,
range: {},
text: null,
};
},
if (selection.from === selection.to) {
if (
selection.from < prev.range.from ||
apply(tr, prev) {
const { selection } = tr;
const next = { ...prev };
if (selection.from === selection.to) {
if (
selection.from < prev.range.from ||
selection.from > prev.range.to
) {
next.active = false;
}
) {
next.active = false;
}
const $position = selection.$from;
const match = matcher($position);
const $position = selection.$from;
const match = matcher($position);
if (match) {
next.active = true;
next.range = match.range;
next.text = match.text;
if (match) {
next.active = true;
next.range = match.range;
next.text = match.text;
} else {
next.active = false;
}
} else {
next.active = false;
}
} else {
next.active = false;
}
if (!next.active) {
next.range = {};
next.text = null;
}
if (!next.active) {
next.range = {};
next.text = null;
}
return next;
return next;
},
},
},
props: {
handleKeyDown(view, event) {
const { active } = this.getState(view.state);
props: {
handleKeyDown(view, event) {
const { active } = this.getState(view.state);
if (!active) return false;
if (!active) return false;
return onKeyDown({ view, event });
},
decorations(editorState) {
const { active, range } = this.getState(editorState);
return onKeyDown({ view, event });
},
decorations(editorState) {
const { active, range } = this.getState(editorState);
if (!active) return null;
if (!active) return null;
return DecorationSet.create(editorState.doc, [
Decoration.inline(range.from, range.to, {
nodeName: 'span',
class: suggestionClass,
}),
]);
return DecorationSet.create(editorState.doc, [
Decoration.inline(range.from, range.to, {
nodeName: 'span',
class: suggestionClass,
}),
]);
},
},
},
});
});
};
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