- Details/Summary
- Checkbox/TODO list items
- Code blocks
-- Inline Code
- Indents
- Iframe/Media
-- Clear formatting
- View Code
- Attachment integration (Drag & drop)
- Template system integration.
- List type changing.
- Color picker options should have "clear" option.
- Color picker buttons should be split, with button to re-apply last selected color.
-- Color picker options should change color if different instead of remove.
\ No newline at end of file
+- Color picker options should change color if different instead of remove.
+- Clear formatting, If no selection range, clear the formatting of parent block.
+ - If no marks, clear the block type if text type?
\ No newline at end of file
const nodeAttrs = Object.assign({}, node.attrs);
if (node.attrs[attrName] !== undefined) {
nodeAttrs[attrName] = attrValue;
- tr.setBlockType(pos, pos+1, node.type, nodeAttrs)
+ tr.setBlockType(pos, pos + 1, node.type, nodeAttrs)
}
});
return true
}
+}
+
+export function removeMarks() {
+ return function (state, dispatch) {
+ if (dispatch) {
+ dispatch(state.tr.removeMark(state.selection.from, state.selection.to, null));
+ }
+ return true;
+ }
}
\ No newline at end of file
width: 24, height: 24,
path: "m 4,11 h 16 v 2 H 4 Z"
},
+ format_clear: {
+ width: 24, height: 24,
+ path: "M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27 3.27 5zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5H6z"
+ },
};
const SVG = "http://www.w3.org/2000/svg"
import {toggleMark} from "prosemirror-commands";
import {menuBar} from "./menubar"
import schema from "../schema";
+import {removeMarks} from "../commands";
function cmdItem(cmd, options) {
label: "Paragraph",
attrs: {}
}),
+ markItem(schema.marks.code, {
+ label: "Inline Code",
+ attrs: {}
+ }),
new DropdownSubmenu([
blockTypeItem(schema.nodes.callout, {
label: "Info Callout",
}),
];
+const utilities = [
+ new MenuItem({
+ title: 'Clear Formatting',
+ icon: icons.format_clear,
+ run: removeMarks(),
+ enable: state => true,
+ }),
+];
+
const menu = menuBar({
floating: false,
content: [
alignments,
lists,
inserts,
+ utilities,
],
});