diff --git a/editors/editoria/src/EditorConfig.js b/editors/editoria/src/EditorConfig.js index 249b80c59c0605c145939bebe988fd8351680db9..9814b90e9e6d762b357b623b0930a4c9898e0aba 100644 --- a/editors/editoria/src/EditorConfig.js +++ b/editors/editoria/src/EditorConfig.js @@ -18,8 +18,6 @@ import { sinkListItem } from "prosemirror-schema-list"; -import { emDash, ellipsis } from "prosemirror-inputrules"; - import invisibles, { space, hardBreak, @@ -102,6 +100,5 @@ const plugins = [ const services = [new LinkService()]; // Add Rules -const rules = [emDash, ellipsis]; -export { schema, keys, plugins, rules, services }; +export { schema, keys, plugins, services }; diff --git a/editors/editoria/src/Editoria.js b/editors/editoria/src/Editoria.js index c2f30f2cfcf365c4aae528500cdf169422e1c99a..9c082a3e2ff5b01fa1995b5ca29d8b5f223982ba 100644 --- a/editors/editoria/src/Editoria.js +++ b/editors/editoria/src/Editoria.js @@ -4,7 +4,7 @@ import { EditoriaLayout } from "wax-prosemirror-layouts"; import { Wax } from "wax-prosemirror-core"; import { schema, keys, plugins, rules, services } from "./EditorConfig"; -import { menu } from "./config"; +import { config } from "./config"; import text from "./text"; @@ -53,7 +53,7 @@ const Editoria = () => ( <Fragment> <GlobalStyle /> <StyledWax - config={menu} + config={config} options={options} autoFocus placeholder="Type Something..." diff --git a/editors/editoria/src/config/menu.js b/editors/editoria/src/config/config.js similarity index 65% rename from editors/editoria/src/config/menu.js rename to editors/editoria/src/config/config.js index b7ec904af3e0343cb9da22728ad42bded7e86570..82fb3775f1ed02ff8924f5e6641e27626487ccd4 100644 --- a/editors/editoria/src/config/menu.js +++ b/editors/editoria/src/config/config.js @@ -1,3 +1,5 @@ +import { emDash, ellipsis } from "prosemirror-inputrules"; + export default { MenuService: [ { @@ -8,5 +10,10 @@ export default { templateArea: "leftSideBar", toolGroups: ["TextStyle"] } + ], + RulesService: [ + { + rules: [emDash, ellipsis] + } ] }; diff --git a/editors/editoria/src/config/index.js b/editors/editoria/src/config/index.js index bf58df0f49bc4730e365ff00cc870334fdc1e113..7f7956eb2edcb829ef92c381826e48f0565cc9ab 100644 --- a/editors/editoria/src/config/index.js +++ b/editors/editoria/src/config/index.js @@ -1 +1 @@ -export { default as menu } from "./menu"; +export { default as config } from "./config"; diff --git a/wax-prosemirror-core/src/Wax.js b/wax-prosemirror-core/src/Wax.js index be5472eca2b1a78ed18d5dfebe65adfebaf4736c..45897065706fbb302f9170effe4aa4b124105c88 100644 --- a/wax-prosemirror-core/src/Wax.js +++ b/wax-prosemirror-core/src/Wax.js @@ -57,17 +57,10 @@ class Wax extends Component { // ? keys // : new CreateShortCuts({ schema: schema, shortCuts: {} }); - // const WaxRules = new CreateRules({ schema: schema, rules: rules }); - const editorContent = value ? value : ""; if (plugins) defaultPlugins.push(...plugins); - // const finalPlugins = defaultPlugins.concat([ - // placeholder({ content: this.props.placeholder }), - // WaxShortCuts, - // WaxRules - // ]); const finalPlugins = defaultPlugins.concat([ placeholder({ content: this.props.placeholder }), ...this.application.getPlugins() diff --git a/wax-prosemirror-plugins/src/RulesService/RulesService.js b/wax-prosemirror-plugins/src/RulesService/RulesService.js index 5544a31cac3258bfac463d47049c89bc84878cd2..8d66b1d5c08bb1a5c7afec701e6fbf2ddaf81cf8 100644 --- a/wax-prosemirror-plugins/src/RulesService/RulesService.js +++ b/wax-prosemirror-plugins/src/RulesService/RulesService.js @@ -1,8 +1,15 @@ import Service from "wax-prosemirror-core/src/services/Service"; +import Rules from "./Rules"; export default class RulesService extends Service { name = "RulesService"; - boot() { - console.log("boot"); + + boot() {} + + register() { + this.container.bind("Rules").toFactory(context => { + return new Rules(this.config[0]); + }); + this.container.get("Rules"); } }