aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormonikahedman <monika_hedman@brown.edu>2019-08-06 17:55:43 -0400
committermonikahedman <monika_hedman@brown.edu>2019-08-06 17:55:43 -0400
commit030af1b9112cd12383abcd7f35142cc382ea4d6a (patch)
treed457a36e8222bfb974374db34addecbeb9edf463 /src
parent17cab0166753aee765585e1eb700fd85583e7cbb (diff)
end of day 8/6
Diffstat (limited to 'src')
-rw-r--r--src/client/util/RichTextSchema.tsx15
-rw-r--r--src/client/util/TooltipTextMenu.tsx11
2 files changed, 22 insertions, 4 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 491208c4c..8e80de1a8 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -193,6 +193,12 @@ 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,
@@ -215,6 +221,15 @@ export const nodes: { [index: string]: NodeSpec } = {
// parseDOM: [{ tag: "ul" }, { style: 'list-style-type=disc' }],
// toDOM() { return ulDOM }
},
+ checkbox_list: {
+ ...bulletList,
+ content: 'list_item+',
+ group: 'block',
+ // style: 'list-style-type:none'
+ itemContent: "+",
+ // parseDOM: [{ tag: "ul" }, { style: 'list-style-type=square' }],
+ // toDOM() { return ulDOM; }
+ },
//bullet_list: {
// content: 'list_item+',
// group: 'block',
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 8f66a0ad4..b1243cb1d 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -10,7 +10,7 @@ import { Node as ProsNode } from "prosemirror-model";
import "./TooltipTextMenu.scss";
const { toggleMark, setBlockType } = require("prosemirror-commands");
import { library } from '@fortawesome/fontawesome-svg-core';
-import { wrapInList, liftListItem, } from 'prosemirror-schema-list';
+import { wrapInList, liftListItem, bulletList, } from 'prosemirror-schema-list';
import { faListUl } from '@fortawesome/free-solid-svg-icons';
import { FieldViewProps } from "../views/nodes/FieldView";
const { openPrompt, TextField } = require("./ProsemirrorCopy/prompt.js");
@@ -177,7 +177,7 @@ export class TooltipTextMenu {
this.listTypeToIcon = new Map();
this.listTypeToIcon.set(schema.nodes.bullet_list, ":");
this.listTypeToIcon.set(schema.nodes.ordered_list, "1)");
- // this.listTypeToIcon.set(schema.nodes.checklist, "⬜");
+ // this.listTypeToIcon.set(schema.nodes.bullet_list, "⬜");
this.listTypes = Array.from(this.listTypeToIcon.keys());
//custom tools
@@ -187,7 +187,7 @@ export class TooltipTextMenu {
this.tooltip.appendChild(this._brushdom);
this.tooltip.appendChild(this.createLink().render(this.view).dom);
this.tooltip.appendChild(this.createStar().render(this.view).dom);
- this.tooltip.appendChild(this.createCheckbox().render(this.view).dom)
+ this.tooltip.appendChild(this.createCheckbox().render(this.view).dom);
this.updateListItemDropdown(":", this.listTypeBtnDom);
@@ -441,12 +441,13 @@ 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(nodeType)(state, dispatch);
+ wrapInList(newNode.type)(state, dispatch);
}
return true;
}
@@ -460,9 +461,11 @@ 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));
+ toAdd.push(this.dropdownNodeBtn("⬜", "color:black; width:40px;", schema.nodes.checkbox_list, this.view, this.listTypes, this.changeToNodeType))
listTypeBtn = (new Dropdown(toAdd, {
label: label,