Skip to content
Snippets Groups Projects
Commit a94ada07 authored by chris's avatar chris
Browse files

active for menus

parent c657c43f
No related branches found
No related tags found
1 merge request!38Develop
import React from "react"; import React from "react";
import { v4 as uuid } from "uuid"; import { v4 as uuid } from "uuid";
import { import {
joinUp, joinUp,
lift, lift,
...@@ -71,7 +70,7 @@ export default { ...@@ -71,7 +70,7 @@ export default {
enable: undo, enable: undo,
run: undo, run: undo,
select: state => true, select: state => true,
menu: props => <Button key={uuid()} {...props} /> menu: props => <Button key={uuid()} {...props} />
}, },
redo: { redo: {
title: "Redo last undone change", title: "Redo last undone change",
...@@ -204,7 +203,9 @@ export default { ...@@ -204,7 +203,9 @@ export default {
blockquote: { blockquote: {
title: "Wrap in block quote", title: "Wrap in block quote",
content: icons.blockquote, content: icons.blockquote,
// active: blockActive(schema.nodes.blockquote), active: state => {
return blockActive(state.config.schema.nodes.blockquote)(state);
},
// enable: wrapIn(schema.nodes.blockquote), // enable: wrapIn(schema.nodes.blockquote),
run(state, dispatch) { run(state, dispatch) {
wrapIn(state.config.schema.nodes.blockquote)(state, dispatch); wrapIn(state.config.schema.nodes.blockquote)(state, dispatch);
...@@ -215,7 +216,9 @@ export default { ...@@ -215,7 +216,9 @@ export default {
bullet_list: { bullet_list: {
title: "Wrap in bullet list", title: "Wrap in bullet list",
content: icons.bullet_list, content: icons.bullet_list,
// active: blockActive(schema.nodes.bullet_list), active: state => {
return blockActive(state.config.schema.nodes.bullet_list)(state);
},
// enable: wrapInList(schema.nodes.bullet_list), // enable: wrapInList(schema.nodes.bullet_list),
run(state, dispatch) { run(state, dispatch) {
wrapInList(state.config.schema.nodes.bullet_list)(state, dispatch); wrapInList(state.config.schema.nodes.bullet_list)(state, dispatch);
...@@ -226,7 +229,9 @@ export default { ...@@ -226,7 +229,9 @@ export default {
ordered_list: { ordered_list: {
title: "Wrap in ordered list", title: "Wrap in ordered list",
content: icons.ordered_list, content: icons.ordered_list,
// active: blockActive(schema.nodes.ordered_list), active: state => {
return blockActive(state.config.schema.nodes.ordered_list)(state);
},
// enable: wrapInList(schema.nodes.ordered_list), // enable: wrapInList(schema.nodes.ordered_list),
run(state, dispatch) { run(state, dispatch) {
wrapInList(state.config.schema.nodes.ordered_list)(state, dispatch); wrapInList(state.config.schema.nodes.ordered_list)(state, dispatch);
...@@ -264,7 +269,6 @@ export default { ...@@ -264,7 +269,6 @@ export default {
content: icons.table, content: icons.table,
// enable: canInsert(schema.nodes.table), // enable: canInsert(schema.nodes.table),
run: (state, dispatch) => { run: (state, dispatch) => {
// const { from } = state.selection
let rowCount = window && window.prompt("How many rows?", 2); let rowCount = window && window.prompt("How many rows?", 2);
let colCount = window && window.prompt("How many columns?", 2); let colCount = window && window.prompt("How many columns?", 2);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment