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

remove example of adding a rule from another service

parent 06934c96
No related branches found
No related tags found
1 merge request!45Develop
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
], ],
RulesService: [ RulesService: [
{ {
rules: [ellipsis] rules: [emDash, ellipsis]
} }
] ]
}; };
...@@ -51,11 +51,9 @@ class Wax extends Component { ...@@ -51,11 +51,9 @@ class Wax extends Component {
const { value, onChange, options } = this.props; const { value, onChange, options } = this.props;
const { schema, plugins, keys, rules } = options; const { schema, plugins, keys, rules } = options;
const WaxOnchange = onChange ? onChange : value => true; const WaxOnchange = onChange ? onChange : value => true;
this.application.bootServices(); this.application.bootServices();
// const WaxShortCuts = keys
// ? keys
// : new CreateShortCuts({ schema: schema, shortCuts: {} });
const editorContent = value ? value : ""; const editorContent = value ? value : "";
if (plugins) defaultPlugins.push(...plugins); if (plugins) defaultPlugins.push(...plugins);
...@@ -64,7 +62,7 @@ class Wax extends Component { ...@@ -64,7 +62,7 @@ class Wax extends Component {
placeholder({ content: this.props.placeholder }), placeholder({ content: this.props.placeholder }),
...this.application.getPlugins() ...this.application.getPlugins()
]); ]);
console.log("cretated?");
this.WaxOptions = { this.WaxOptions = {
schema, schema,
plugins: finalPlugins plugins: finalPlugins
......
import Service from "wax-prosemirror-core/src/services/Service"; import Service from "wax-prosemirror-core/src/services/Service";
import placeholderPlugin from "./pmPlugins/placeholderPlugin"; import placeholderPlugin from "./pmPlugins/placeholderPlugin";
const PLUGIN_KEY = "imagePlaceHolder"; const PLUGIN_KEY = "imagePlaceHolder";
import { emDash } from "prosemirror-inputrules";
export default class PlaceholderService extends Service { export default class PlaceholderService extends Service {
name = "PlaceholderService"; name = "PlaceholderService";
register() { register() {
const rules = this.container.get("Rules");
rules.addRule([emDash]);
this.app.PmPlugins.add(PLUGIN_KEY, placeholderPlugin(PLUGIN_KEY)); this.app.PmPlugins.add(PLUGIN_KEY, placeholderPlugin(PLUGIN_KEY));
} }
} }
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