aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/RichTextSchema.tsx52
-rw-r--r--src/client/util/TooltipTextMenu.tsx9
-rw-r--r--src/client/views/collections/CollectionViewChromes.tsx2
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx1
4 files changed, 33 insertions, 31 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 8e80de1a8..733c50d20 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -6,6 +6,7 @@ import { orderedList, bulletList, listItem, } from 'prosemirror-schema-list';
import { EditorState, Transaction, NodeSelection, TextSelection, Selection, } from "prosemirror-state";
import { EditorView, } from "prosemirror-view";
import { View } from '@react-pdf/renderer';
+import { TooltipTextMenu } from './TooltipTextMenu';
const pDOM: DOMOutputSpecArray = ["p", 0], blockquoteDOM: DOMOutputSpecArray = ["blockquote", 0], hrDOM: DOMOutputSpecArray = ["hr"],
preDOM: DOMOutputSpecArray = ["pre", ["code", 0]], brDOM: DOMOutputSpecArray = ["br"], ulDOM: DOMOutputSpecArray = ["ul", 0];
@@ -111,30 +112,16 @@ export const nodes: { [index: string]: NodeSpec } = {
// }]
},
- // TODO
checkbox: {
inline: true,
attrs: {
- visibility: { default: false },
- // text: { default: undefined },
- // textslice: { default: undefined },
- // textlen: { default: 0 }
-
+ visibility: { default: false }
},
group: "inline",
toDOM(node) {
const attrs = { style: `width: 40px` };
return ["span", { ...node.attrs, ...attrs }];
},
- // parseDOM: [{
- // tag: "star", getAttrs(dom: any) {
- // return {
- // visibility: dom.getAttribute("visibility"),
- // oldtext: dom.getAttribute("oldtext"),
- // oldtextlen: dom.getAttribute("oldtextlen"),
- // }
- // }
- // }]
},
// :: NodeSpec An inline image (`<img>`) node. Supports `src`,
@@ -193,12 +180,6 @@ export const nodes: { [index: string]: NodeSpec } = {
}
},
- checkbox_list2: {
- inline: false,
- // content: 'list_item+',
- group: 'block'
- },
-
// :: NodeSpec A hard line break, represented in the DOM as `<br>`.
hard_break: {
inline: true,
@@ -221,15 +202,20 @@ export const nodes: { [index: string]: NodeSpec } = {
// parseDOM: [{ tag: "ul" }, { style: 'list-style-type=disc' }],
// toDOM() { return ulDOM }
},
+
checkbox_list: {
- ...bulletList,
- content: 'list_item+',
+ content: 'checklist_item+',
+ marks: '_',
group: 'block',
- // style: 'list-style-type:none'
- itemContent: "+",
- // parseDOM: [{ tag: "ul" }, { style: 'list-style-type=square' }],
- // toDOM() { return ulDOM; }
+ // inline: true,
+ parseDOM: [
+ { tag: "ul" }
+ ],
+ toDOM() {
+ return ["ul", { style: 'list-style: none' }, 0];
+ },
},
+
//bullet_list: {
// content: 'list_item+',
// group: 'block',
@@ -241,6 +227,18 @@ export const nodes: { [index: string]: NodeSpec } = {
list_item: {
...listItem,
content: 'paragraph block*'
+ },
+
+ checklist_item: {
+ content: 'paragraph block*',
+ parseDOM: [{ tag: "li" }],
+ // toDOM() {
+ // return ["li", { style: 'content: checkbox' }, 0];
+ // },
+ toDOM() {
+ return ["li", 0];
+ },
+ defining: true
}
};
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index b1243cb1d..8112ed868 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -441,13 +441,10 @@ export class TooltipTextMenu {
return true;
}
- // this needs to change so it makes it into a bulleted list
public static insertCheckbox(state: EditorState<any>, dispatch: any) {
let newNode = schema.nodes.checkbox.create({ visibility: false });
if (dispatch) {
- //console.log(newNode.attrs.text.toString());
dispatch(state.tr.replaceSelectionWith(newNode));
- wrapInList(newNode.type)(state, dispatch);
}
return true;
}
@@ -461,7 +458,6 @@ export class TooltipTextMenu {
let toAdd: MenuItem[] = [];
this.listTypeToIcon.forEach((icon, type) => {
toAdd.push(this.dropdownNodeBtn(icon, "color: black; width: 40px;", type, this.view, this.listTypes, this.changeToNodeType));
- console.log(type.name)
});
//option to remove the list formatting
toAdd.push(this.dropdownNodeBtn("X", "color: black; width: 40px;", undefined, this.view, this.listTypes, this.changeToNodeType));
@@ -529,6 +525,11 @@ export class TooltipTextMenu {
liftListItem(schema.nodes.list_item)(view.state, view.dispatch);
if (nodeType) { //add new
wrapInList(nodeType)(view.state, view.dispatch);
+ // console.log(nodeType === schema.nodes.checkbox_list)
+ // if (nodeType === schema.nodes.checkbox_list) {
+ // TooltipTextMenu.insertCheckbox(view.state, view.dispatch)
+ // }
+
}
}
diff --git a/src/client/views/collections/CollectionViewChromes.tsx b/src/client/views/collections/CollectionViewChromes.tsx
index 52c47e7e8..5b673c8ec 100644
--- a/src/client/views/collections/CollectionViewChromes.tsx
+++ b/src/client/views/collections/CollectionViewChromes.tsx
@@ -33,6 +33,8 @@ let stopPropagation = (e: React.SyntheticEvent) => e.stopPropagation();
@observer
export class CollectionViewBaseChrome extends React.Component<CollectionViewChromeProps> {
+ //.*?doc\.(\w+).*?\("(\w+)
+
@observable private _viewSpecsOpen: boolean = false;
@observable private _dateWithinValue: string = "";
@observable private _dateValue: Date | string = "";
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 303b1ac88..d1771eb0f 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -177,6 +177,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
this._editorView.updateState(state);
if (state.selection.empty && FormattedTextBox._toolTipTextMenu) {
const marks = tx.storedMarks;
+ console.log(marks)
if (marks) { FormattedTextBox._toolTipTextMenu.mark_key_pressed(marks); }
}
this._applyingChange = true;