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

@seorii/prosemirror-math

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seorii/prosemirror-math - npm Package Compare versions

Comparing version 0.3.8 to 0.4.0

2

dist/index.d.ts

@@ -39,3 +39,3 @@ /// <reference types="g" />

*/
declare function createMathView(displayMode: boolean): (node: ProseNode, view: EditorView, getPos: any) => MathView;
declare function createMathView(displayMode: boolean, all?: boolean): (node: ProseNode, view: EditorView, getPos: any) => MathView;
declare const mathPlugin: ProsePlugin<IMathPluginState>;

@@ -42,0 +42,0 @@ //// INLINE MATH NODEVIEW //////////////////////////////////

@@ -39,3 +39,3 @@ /// <reference types="g" />

*/
declare function createMathView(displayMode: boolean): (node: ProseNode, view: EditorView, getPos: any) => MathView;
declare function createMathView(displayMode: boolean, all?: boolean): (node: ProseNode, view: EditorView, getPos: any) => MathView;
declare const mathPlugin: ProsePlugin<IMathPluginState>;

@@ -42,0 +42,0 @@ //// INLINE MATH NODEVIEW //////////////////////////////////

@@ -386,3 +386,5 @@ import { TextSelection, Plugin, EditorState, PluginKey, NodeSelection } from 'prosemirror-state';

// uniquely identifies the prosemirror-math plugin
const MATH_PLUGIN_KEY = new PluginKey("prosemirror-math");
const MATH_ALL_PLUGIN_KEY = new PluginKey("prosemirror");
const MATH_INLINE_PLUGIN_KEY = new PluginKey("prosemirror-math-inline");
const MATH_DISPLAY_PLUGIN_KEY = new PluginKey("prosemirror-math-display");
/**

@@ -393,4 +395,5 @@ * Returns a function suitable for passing as a field in `EditorProps.nodeViews`.

*/
function createMathView(displayMode) {
function createMathView(displayMode, all = false) {
return (node, view, getPos) => {
const MATH_PLUGIN_KEY = all ? MATH_DISPLAY_PLUGIN_KEY : (displayMode ? MATH_DISPLAY_PLUGIN_KEY : MATH_INLINE_PLUGIN_KEY);
/** @todo is this necessary?

@@ -413,4 +416,34 @@ * Docs says that for any function proprs, the current plugin instance

}
let mathInlinePluginSpec = {
key: MATH_INLINE_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_inline": createMathView(false)
}
}
};
let mathPluginSpec = {
key: MATH_PLUGIN_KEY,
key: MATH_ALL_PLUGIN_KEY,
state: {

@@ -440,3 +473,33 @@ init(config, instance) {

nodeViews: {
"math_inline": createMathView(false),
"math_inline": createMathView(false, true),
"math_display": createMathView(true, true)
}
}
};
let mathDisplayPluginSpec = {
key: MATH_DISPLAY_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_display": createMathView(true)

@@ -446,2 +509,4 @@ }

};
new Plugin(mathInlinePluginSpec);
new Plugin(mathDisplayPluginSpec);
const mathPlugin = new Plugin(mathPluginSpec);

@@ -448,0 +513,0 @@

@@ -388,3 +388,5 @@ 'use strict';

// uniquely identifies the prosemirror-math plugin
const MATH_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror-math");
const MATH_ALL_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror");
const MATH_INLINE_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror-math-inline");
const MATH_DISPLAY_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror-math-display");
/**

@@ -395,4 +397,5 @@ * Returns a function suitable for passing as a field in `EditorProps.nodeViews`.

*/
function createMathView(displayMode) {
function createMathView(displayMode, all = false) {
return (node, view, getPos) => {
const MATH_PLUGIN_KEY = all ? MATH_DISPLAY_PLUGIN_KEY : (displayMode ? MATH_DISPLAY_PLUGIN_KEY : MATH_INLINE_PLUGIN_KEY);
/** @todo is this necessary?

@@ -415,4 +418,34 @@ * Docs says that for any function proprs, the current plugin instance

}
let mathInlinePluginSpec = {
key: MATH_INLINE_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_inline": createMathView(false)
}
}
};
let mathPluginSpec = {
key: MATH_PLUGIN_KEY,
key: MATH_ALL_PLUGIN_KEY,
state: {

@@ -442,3 +475,33 @@ init(config, instance) {

nodeViews: {
"math_inline": createMathView(false),
"math_inline": createMathView(false, true),
"math_display": createMathView(true, true)
}
}
};
let mathDisplayPluginSpec = {
key: MATH_DISPLAY_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_display": createMathView(true)

@@ -448,2 +511,4 @@ }

};
new prosemirrorState.Plugin(mathInlinePluginSpec);
new prosemirrorState.Plugin(mathDisplayPluginSpec);
const mathPlugin = new prosemirrorState.Plugin(mathPluginSpec);

@@ -450,0 +515,0 @@

@@ -438,3 +438,5 @@ import { Node, mergeAttributes } from '@tiptap/core';

// uniquely identifies the prosemirror-math plugin
const MATH_PLUGIN_KEY = new PluginKey("prosemirror-math");
const MATH_ALL_PLUGIN_KEY = new PluginKey("prosemirror");
const MATH_INLINE_PLUGIN_KEY = new PluginKey("prosemirror-math-inline");
const MATH_DISPLAY_PLUGIN_KEY = new PluginKey("prosemirror-math-display");
/**

@@ -445,4 +447,5 @@ * Returns a function suitable for passing as a field in `EditorProps.nodeViews`.

*/
function createMathView(displayMode) {
function createMathView(displayMode, all = false) {
return (node, view, getPos) => {
const MATH_PLUGIN_KEY = all ? MATH_DISPLAY_PLUGIN_KEY : (displayMode ? MATH_DISPLAY_PLUGIN_KEY : MATH_INLINE_PLUGIN_KEY);
/** @todo is this necessary?

@@ -465,4 +468,34 @@ * Docs says that for any function proprs, the current plugin instance

}
let mathInlinePluginSpec = {
key: MATH_INLINE_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_inline": createMathView(false)
}
}
};
let mathPluginSpec = {
key: MATH_PLUGIN_KEY,
key: MATH_ALL_PLUGIN_KEY,
state: {

@@ -492,3 +525,33 @@ init(config, instance) {

nodeViews: {
"math_inline": createMathView(false),
"math_inline": createMathView(false, true),
"math_display": createMathView(true, true)
}
}
};
let mathDisplayPluginSpec = {
key: MATH_DISPLAY_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_display": createMathView(true)

@@ -498,3 +561,5 @@ }

};
const mathPlugin = new Plugin(mathPluginSpec);
const mathInlinePlugin = new Plugin(mathInlinePluginSpec);
const mathDisplayPlugin = new Plugin(mathDisplayPluginSpec);
new Plugin(mathPluginSpec);

@@ -605,3 +670,3 @@ const mathBackspaceCmd = (state, dispatch) => {

});
return [mathPlugin, inputRulePlugin, mathSelectPlugin, keymap({
return [mathInlinePlugin, inputRulePlugin, mathSelectPlugin, keymap({
"Backspace": chainCommands(deleteSelection, mathBackspaceCmd, joinBackward, selectNodeBackward),

@@ -627,5 +692,3 @@ })];

});
return [mathPlugin, inputRulePlugin, mathSelectPlugin, keymap({
"Backspace": chainCommands(deleteSelection, mathBackspaceCmd, joinBackward, selectNodeBackward),
})];
return [mathDisplayPlugin, inputRulePlugin];
},

@@ -632,0 +695,0 @@ });

@@ -440,3 +440,5 @@ 'use strict';

// uniquely identifies the prosemirror-math plugin
const MATH_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror-math");
const MATH_ALL_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror");
const MATH_INLINE_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror-math-inline");
const MATH_DISPLAY_PLUGIN_KEY = new prosemirrorState.PluginKey("prosemirror-math-display");
/**

@@ -447,4 +449,5 @@ * Returns a function suitable for passing as a field in `EditorProps.nodeViews`.

*/
function createMathView(displayMode) {
function createMathView(displayMode, all = false) {
return (node, view, getPos) => {
const MATH_PLUGIN_KEY = all ? MATH_DISPLAY_PLUGIN_KEY : (displayMode ? MATH_DISPLAY_PLUGIN_KEY : MATH_INLINE_PLUGIN_KEY);
/** @todo is this necessary?

@@ -467,4 +470,34 @@ * Docs says that for any function proprs, the current plugin instance

}
let mathInlinePluginSpec = {
key: MATH_INLINE_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_inline": createMathView(false)
}
}
};
let mathPluginSpec = {
key: MATH_PLUGIN_KEY,
key: MATH_ALL_PLUGIN_KEY,
state: {

@@ -494,3 +527,33 @@ init(config, instance) {

nodeViews: {
"math_inline": createMathView(false),
"math_inline": createMathView(false, true),
"math_display": createMathView(true, true)
}
}
};
let mathDisplayPluginSpec = {
key: MATH_DISPLAY_PLUGIN_KEY,
state: {
init(config, instance) {
return {
macros: {},
activeNodeViews: [],
prevCursorPos: 0,
};
},
apply(tr, value, oldState, newState) {
// produce updated state field for this plugin
return {
// these values are left unchanged
activeNodeViews: value.activeNodeViews,
macros: value.macros,
// update with the second-most recent cursor pos
prevCursorPos: oldState.selection.from
};
},
/** @todo (8/21/20) implement serialization for math plugin */
// toJSON(value) { },
// fromJSON(config, value, state){ return {}; }
},
props: {
nodeViews: {
"math_display": createMathView(true)

@@ -500,3 +563,5 @@ }

};
const mathPlugin = new prosemirrorState.Plugin(mathPluginSpec);
const mathInlinePlugin = new prosemirrorState.Plugin(mathInlinePluginSpec);
const mathDisplayPlugin = new prosemirrorState.Plugin(mathDisplayPluginSpec);
new prosemirrorState.Plugin(mathPluginSpec);

@@ -607,3 +672,3 @@ const mathBackspaceCmd = (state, dispatch) => {

});
return [mathPlugin, inputRulePlugin, mathSelectPlugin, prosemirrorKeymap.keymap({
return [mathInlinePlugin, inputRulePlugin, mathSelectPlugin, prosemirrorKeymap.keymap({
"Backspace": prosemirrorCommands.chainCommands(prosemirrorCommands.deleteSelection, mathBackspaceCmd, prosemirrorCommands.joinBackward, prosemirrorCommands.selectNodeBackward),

@@ -629,5 +694,3 @@ })];

});
return [mathPlugin, inputRulePlugin, mathSelectPlugin, prosemirrorKeymap.keymap({
"Backspace": prosemirrorCommands.chainCommands(prosemirrorCommands.deleteSelection, mathBackspaceCmd, prosemirrorCommands.joinBackward, prosemirrorCommands.selectNodeBackward),
})];
return [mathDisplayPlugin, inputRulePlugin];
},

@@ -634,0 +697,0 @@ });

{
"name": "@seorii/prosemirror-math",
"version": "0.3.8",
"version": "0.4.0",
"description": "Schema and plugins for first-class math support in ProseMirror.",

@@ -5,0 +5,0 @@ "repository": "github:benrbray/prosemirror-math",

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

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