Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
smoores-dev committed Oct 11, 2024
1 parent 4e764a1 commit dec6a57
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 99 deletions.
6 changes: 3 additions & 3 deletions dist/cjs/components/MarkView.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ const MarkView = /*#__PURE__*/ (0, _react.memo)(/*#__PURE__*/ (0, _react.forward
if (!domRef.current) return;
const firstChildDesc = childDescriptors.current[0];
if (!viewDescRef.current) {
viewDescRef.current = new _viewdescJs.MarkViewDesc(parentRef.current, childDescriptors.current, getPos.current(), mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current);
viewDescRef.current = new _viewdescJs.MarkViewDesc(parentRef.current, childDescriptors.current, ()=>getPos.current(), mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.dom = domRef.current;
viewDescRef.current.contentDOM = firstChildDesc?.dom.parentElement ?? domRef.current;
viewDescRef.current.mark = mark;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
for (const childDesc of childDescriptors.current){
childDesc.parent = viewDescRef.current;
}
Expand Down
6 changes: 3 additions & 3 deletions dist/cjs/components/NativeWidgetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ function NativeWidgetView(param) {
(0, _react.useLayoutEffect)(()=>{
if (!rootDomRef.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new _viewdescJs.WidgetViewDesc(parentRef.current, getPos.current(), widget, rootDomRef.current);
viewDescRef.current = new _viewdescJs.WidgetViewDesc(parentRef.current, ()=>getPos.current(), widget, rootDomRef.current);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.widget = widget;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
viewDescRef.current.dom = rootDomRef.current;
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
return /*#__PURE__*/ _react.default.createElement("span", {
ref: rootDomRef
Expand Down
5 changes: 3 additions & 2 deletions dist/cjs/components/SeparatorHackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ function SeparatorHackView(param) {
}
if (!ref.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new _viewdescJs.TrailingHackViewDesc(parentRef.current, [], getPos.current(), ref.current, null);
viewDescRef.current = new _viewdescJs.TrailingHackViewDesc(parentRef.current, [], ()=>getPos.current(), ref.current, null);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.dom = ref.current;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
return shouldRender ? /*#__PURE__*/ _react.default.createElement("img", {
ref: ref,
Expand Down
8 changes: 4 additions & 4 deletions dist/cjs/components/TextNodeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let TextNodeView = class TextNodeView extends _react.Component {
// Otherwise we just rely on re-rendering the renderRef
if (!dom) {
if (!view?.composing) return;
this.viewDescRef = new _viewdescJs.CompositionViewDesc(parentRef.current, getPos.current(), // These are just placeholders/dummies. We can't
this.viewDescRef = new _viewdescJs.CompositionViewDesc(parentRef.current, ()=>getPos.current(), // These are just placeholders/dummies. We can't
// actually find the correct DOM nodes from here,
// so we let our parent do it.
// Passing a valid element here just so that the
Expand All @@ -57,12 +57,12 @@ let TextNodeView = class TextNodeView extends _react.Component {
textNode = textNode.firstChild;
}
if (!this.viewDescRef || this.viewDescRef instanceof _viewdescJs.CompositionViewDesc) {
this.viewDescRef = new _viewdescJs.TextViewDesc(undefined, [], getPos.current(), node, decorations, _prosemirrorView.DecorationSet.empty, dom, textNode);
this.viewDescRef = new _viewdescJs.TextViewDesc(undefined, [], ()=>getPos.current(), node, decorations, _prosemirrorView.DecorationSet.empty, dom, textNode);
} else {
this.viewDescRef.parent = parentRef.current;
this.viewDescRef.children = [];
this.viewDescRef.node = node;
this.viewDescRef.pos = getPos.current();
this.viewDescRef.getPos = ()=>getPos.current();
this.viewDescRef.outerDeco = decorations;
this.viewDescRef.innerDeco = _prosemirrorView.DecorationSet.empty;
this.viewDescRef.dom = dom;
Expand All @@ -73,7 +73,7 @@ let TextNodeView = class TextNodeView extends _react.Component {
if (!siblingsRef.current.includes(this.viewDescRef)) {
siblingsRef.current.push(this.viewDescRef);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
}
shouldComponentUpdate(nextProps) {
return !shallowEqual(this.props, nextProps);
Expand Down
6 changes: 3 additions & 3 deletions dist/cjs/components/TrailingHackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ function TrailingHackView(param) {
(0, _react.useLayoutEffect)(()=>{
if (!ref.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new _viewdescJs.TrailingHackViewDesc(parentRef.current, [], getPos.current(), ref.current, null);
viewDescRef.current = new _viewdescJs.TrailingHackViewDesc(parentRef.current, [], ()=>getPos.current(), ref.current, null);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.dom = ref.current;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
return /*#__PURE__*/ _react.default.createElement("br", {
ref: ref,
Expand Down
6 changes: 3 additions & 3 deletions dist/cjs/components/WidgetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ function WidgetView(param) {
(0, _react.useLayoutEffect)(()=>{
if (!domRef.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new _viewdescJs.WidgetViewDesc(parentRef.current, getPos.current(), widget, domRef.current);
viewDescRef.current = new _viewdescJs.WidgetViewDesc(parentRef.current, ()=>getPos.current(), widget, domRef.current);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.widget = widget;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
viewDescRef.current.dom = domRef.current;
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
const { Component } = widget.type;
return Component && /*#__PURE__*/ _react.default.createElement(Component, {
Expand Down
2 changes: 1 addition & 1 deletion dist/cjs/hooks/useEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function useEditor(mount, options) {
options.state
]);
const tempDom = document.createElement("div");
const docViewDescRef = (0, _react.useRef)(new _viewdescJs.NodeViewDesc(undefined, [], -1, state.doc, [], _prosemirrorView.DecorationSet.empty, tempDom, null, tempDom, ()=>false));
const docViewDescRef = (0, _react.useRef)(new _viewdescJs.NodeViewDesc(undefined, [], ()=>-1, state.doc, [], _prosemirrorView.DecorationSet.empty, tempDom, null, tempDom, ()=>false));
const directEditorProps = {
...options,
state,
Expand Down
6 changes: 3 additions & 3 deletions dist/cjs/hooks/useNodeViewDescriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ function useNodeViewDescriptor(node, getPos, domRef, nodeDomRef, innerDecoration
if (!node || !nodeDomRef.current) return;
const firstChildDesc = childDescriptors.current[0];
if (!nodeViewDescRef.current) {
nodeViewDescRef.current = new _viewdescJs.NodeViewDesc(parentRef.current, childDescriptors.current, getPos(), node, outerDecorations, innerDecorations, domRef?.current ?? nodeDomRef.current, firstChildDesc?.dom.parentElement ?? null, nodeDomRef.current, (event)=>!!stopEvent.current(event));
nodeViewDescRef.current = new _viewdescJs.NodeViewDesc(parentRef.current, childDescriptors.current, getPos, node, outerDecorations, innerDecorations, domRef?.current ?? nodeDomRef.current, firstChildDesc?.dom.parentElement ?? null, nodeDomRef.current, (event)=>!!stopEvent.current(event));
} else {
nodeViewDescRef.current.parent = parentRef.current;
nodeViewDescRef.current.children = childDescriptors.current;
nodeViewDescRef.current.node = node;
nodeViewDescRef.current.pos = getPos();
nodeViewDescRef.current.getPos = getPos;
nodeViewDescRef.current.outerDeco = outerDecorations;
nodeViewDescRef.current.innerDeco = innerDecorations;
nodeViewDescRef.current.dom = domRef?.current ?? nodeDomRef.current;
Expand All @@ -59,7 +59,7 @@ function useNodeViewDescriptor(node, getPos, domRef, nodeDomRef, innerDecoration
if (!siblingsRef.current.includes(nodeViewDescRef.current)) {
siblingsRef.current.push(nodeViewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
for (const childDesc of childDescriptors.current){
childDesc.parent = nodeViewDescRef.current;
// Because TextNodeViews can't locate the DOM nodes
Expand Down
24 changes: 12 additions & 12 deletions dist/cjs/viewdesc.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ let ViewDesc = class ViewDesc {
get ignoreForCoords() {
return false;
}
constructor(parent, children, pos, dom, contentDOM){
constructor(parent, children, getPos, dom, contentDOM){
this.parent = parent;
this.children = children;
this.pos = pos;
this.getPos = getPos;
this.dom = dom;
this.contentDOM = contentDOM;
this.dirty = NOT_DIRTY;
Expand Down Expand Up @@ -458,8 +458,8 @@ let WidgetViewDesc = class WidgetViewDesc extends ViewDesc {
get side() {
return this.widget.type.side;
}
constructor(parent, pos, widget, dom){
super(parent, [], pos, dom, null);
constructor(parent, getPos, widget, dom){
super(parent, [], getPos, dom, null);
this.widget = widget;
this.widget = widget;
}
Expand All @@ -481,8 +481,8 @@ let CompositionViewDesc = class CompositionViewDesc extends ViewDesc {
ignoreMutation(mut) {
return mut.type === "characterData" && mut.target.nodeValue == mut.oldValue;
}
constructor(parent, pos, dom, textDOM, text){
super(parent, [], pos, dom, null);
constructor(parent, getPos, dom, textDOM, text){
super(parent, [], getPos, dom, null);
this.textDOM = textDOM;
this.text = text;
}
Expand All @@ -509,8 +509,8 @@ let MarkViewDesc = class MarkViewDesc extends ViewDesc {
this.dirty = NOT_DIRTY;
}
}
constructor(parent, children, pos, mark, dom, contentDOM){
super(parent, children, pos, dom, contentDOM);
constructor(parent, children, getPos, mark, dom, contentDOM){
super(parent, children, getPos, dom, contentDOM);
this.mark = mark;
}
};
Expand Down Expand Up @@ -580,8 +580,8 @@ let NodeViewDesc = class NodeViewDesc extends ViewDesc {
get domAtom() {
return this.node.isAtom;
}
constructor(parent, children, pos, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, stopEvent){
super(parent, children, pos, dom, contentDOM);
constructor(parent, children, getPos, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, stopEvent){
super(parent, children, getPos, dom, contentDOM);
this.node = node;
this.outerDeco = outerDeco;
this.innerDeco = innerDeco;
Expand Down Expand Up @@ -625,8 +625,8 @@ let TextViewDesc = class TextViewDesc extends NodeViewDesc {
get domAtom() {
return false;
}
constructor(parent, children, pos, node, outerDeco, innerDeco, dom, nodeDOM){
super(parent, children, pos, node, outerDeco, innerDeco, dom, null, nodeDOM, ()=>false);
constructor(parent, children, getPos, node, outerDeco, innerDeco, dom, nodeDOM){
super(parent, children, getPos, node, outerDeco, innerDeco, dom, null, nodeDOM, ()=>false);
}
};
let TrailingHackViewDesc = class TrailingHackViewDesc extends ViewDesc {
Expand Down
6 changes: 3 additions & 3 deletions dist/esm/components/MarkView.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ export const MarkView = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function Mar
if (!domRef.current) return;
const firstChildDesc = childDescriptors.current[0];
if (!viewDescRef.current) {
viewDescRef.current = new MarkViewDesc(parentRef.current, childDescriptors.current, getPos.current(), mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current);
viewDescRef.current = new MarkViewDesc(parentRef.current, childDescriptors.current, ()=>getPos.current(), mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.dom = domRef.current;
viewDescRef.current.contentDOM = firstChildDesc?.dom.parentElement ?? domRef.current;
viewDescRef.current.mark = mark;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
for (const childDesc of childDescriptors.current){
childDesc.parent = viewDescRef.current;
}
Expand Down
6 changes: 3 additions & 3 deletions dist/esm/components/NativeWidgetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ export function NativeWidgetView(param) {
useLayoutEffect(()=>{
if (!rootDomRef.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new WidgetViewDesc(parentRef.current, getPos.current(), widget, rootDomRef.current);
viewDescRef.current = new WidgetViewDesc(parentRef.current, ()=>getPos.current(), widget, rootDomRef.current);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.widget = widget;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
viewDescRef.current.dom = rootDomRef.current;
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
return /*#__PURE__*/ React.createElement("span", {
ref: rootDomRef
Expand Down
5 changes: 3 additions & 2 deletions dist/esm/components/SeparatorHackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ export function SeparatorHackView(param) {
}
if (!ref.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new TrailingHackViewDesc(parentRef.current, [], getPos.current(), ref.current, null);
viewDescRef.current = new TrailingHackViewDesc(parentRef.current, [], ()=>getPos.current(), ref.current, null);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.dom = ref.current;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
return shouldRender ? /*#__PURE__*/ React.createElement("img", {
ref: ref,
Expand Down
8 changes: 4 additions & 4 deletions dist/esm/components/TextNodeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class TextNodeView extends Component {
// Otherwise we just rely on re-rendering the renderRef
if (!dom) {
if (!view?.composing) return;
this.viewDescRef = new CompositionViewDesc(parentRef.current, getPos.current(), // These are just placeholders/dummies. We can't
this.viewDescRef = new CompositionViewDesc(parentRef.current, ()=>getPos.current(), // These are just placeholders/dummies. We can't
// actually find the correct DOM nodes from here,
// so we let our parent do it.
// Passing a valid element here just so that the
Expand All @@ -49,12 +49,12 @@ export class TextNodeView extends Component {
textNode = textNode.firstChild;
}
if (!this.viewDescRef || this.viewDescRef instanceof CompositionViewDesc) {
this.viewDescRef = new TextViewDesc(undefined, [], getPos.current(), node, decorations, DecorationSet.empty, dom, textNode);
this.viewDescRef = new TextViewDesc(undefined, [], ()=>getPos.current(), node, decorations, DecorationSet.empty, dom, textNode);
} else {
this.viewDescRef.parent = parentRef.current;
this.viewDescRef.children = [];
this.viewDescRef.node = node;
this.viewDescRef.pos = getPos.current();
this.viewDescRef.getPos = ()=>getPos.current();
this.viewDescRef.outerDeco = decorations;
this.viewDescRef.innerDeco = DecorationSet.empty;
this.viewDescRef.dom = dom;
Expand All @@ -65,7 +65,7 @@ export class TextNodeView extends Component {
if (!siblingsRef.current.includes(this.viewDescRef)) {
siblingsRef.current.push(this.viewDescRef);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
}
shouldComponentUpdate(nextProps) {
return !shallowEqual(this.props, nextProps);
Expand Down
6 changes: 3 additions & 3 deletions dist/esm/components/TrailingHackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ export function TrailingHackView(param) {
useLayoutEffect(()=>{
if (!ref.current) return;
if (!viewDescRef.current) {
viewDescRef.current = new TrailingHackViewDesc(parentRef.current, [], getPos.current(), ref.current, null);
viewDescRef.current = new TrailingHackViewDesc(parentRef.current, [], ()=>getPos.current(), ref.current, null);
} else {
viewDescRef.current.parent = parentRef.current;
viewDescRef.current.dom = ref.current;
viewDescRef.current.pos = getPos.current();
viewDescRef.current.getPos = ()=>getPos.current();
}
if (!siblingsRef.current.includes(viewDescRef.current)) {
siblingsRef.current.push(viewDescRef.current);
}
siblingsRef.current.sort((a, b)=>a.pos - b.pos);
siblingsRef.current.sort((a, b)=>a.getPos() - b.getPos());
});
return /*#__PURE__*/ React.createElement("br", {
ref: ref,
Expand Down
Loading

0 comments on commit dec6a57

Please sign in to comment.