From facb15599a9d5b65137ec11a08e6f7e86a8a2732 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 13 Dec 2019 16:32:02 +0200 Subject: [PATCH] simpler config --- editors/editoria/src/EditorConfig.js | 28 +------------------ editors/editoria/src/config/config.js | 25 +++++++++++------ .../src/Config/defaultConfig.js | 4 ++- wax-prosemirror-plugins/index.js | 1 + .../src/RulesService/RulesService.js | 2 +- 5 files changed, 22 insertions(+), 38 deletions(-) diff --git a/editors/editoria/src/EditorConfig.js b/editors/editoria/src/EditorConfig.js index 3685f4eca..4d7ed6ec9 100644 --- a/editors/editoria/src/EditorConfig.js +++ b/editors/editoria/src/EditorConfig.js @@ -18,11 +18,6 @@ import { sinkListItem } from "prosemirror-schema-list"; -import invisibles, { - space, - hardBreak, - paragraph -} from "@guardian/prosemirror-invisibles"; import { LayoutService } from "./customServices/LayoutService/LayoutService"; import { CreateSchema } from "wax-prosemirror-core"; @@ -33,8 +28,6 @@ import { LinkService } from "wax-prosemirror-plugins"; -// import { MainMenuBar, SideMenuBar } from "wax-prosemirror-components"; - import { tableNodes, columnResizing, tableEditing } from "prosemirror-tables"; import { EditoriaSchema } from "wax-prosemirror-schema"; @@ -49,27 +42,8 @@ const extraNodes = { EditoriaSchema.nodes = { ...EditoriaSchema.nodes, ...extraNodes }; const schema = new CreateSchema(EditoriaSchema); -// Add Plugins -const plugins = [ - columnResizing(), - tableEditing(), - TrackChangePlugin({ options: {} }), - invisibles([hardBreak()]) - // FindAndReplacePlugin, - // MenuBarPlugin({ - // Component: MainMenuBar, - // renderArea: "topBar", - // menuItems: ["undo", "redo"] - // }), - // MenuBarPlugin({ - // Component: SideMenuBar, - // renderArea: "leftSideBar" - // //menuItems: ["plain"] - // }) -]; - const services = [new LinkService()]; // Add Rules -export { schema, plugins, services }; +export { schema, services }; diff --git a/editors/editoria/src/config/config.js b/editors/editoria/src/config/config.js index 83e471e24..cf79f16b0 100644 --- a/editors/editoria/src/config/config.js +++ b/editors/editoria/src/config/config.js @@ -1,4 +1,10 @@ import { emDash, ellipsis } from "prosemirror-inputrules"; +import { columnResizing, tableEditing } from "prosemirror-tables"; +import invisibles, { + space, + hardBreak, + paragraph +} from "@guardian/prosemirror-invisibles"; export default { MenuService: [ @@ -11,14 +17,15 @@ export default { toolGroups: ["TextStyle"] } ], - RulesService: [ - { - rules: [emDash, ellipsis] - } - ], - ShortCutsService: [ - { - shortCuts: {} - } + + RulesService: [emDash, ellipsis], + + ShortCutsService: {}, + + PluginsService: [ + columnResizing(), + tableEditing(), + // TrackChangePlugin({ options: {} }), + invisibles([hardBreak()]) ] }; diff --git a/wax-prosemirror-core/src/Config/defaultConfig.js b/wax-prosemirror-core/src/Config/defaultConfig.js index d49e24606..21a6bf86d 100644 --- a/wax-prosemirror-core/src/Config/defaultConfig.js +++ b/wax-prosemirror-core/src/Config/defaultConfig.js @@ -7,13 +7,15 @@ import { PlaceholderService, RulesService, ShortCutsService, - TextStyleService + TextStyleService, + PluginsService } from "wax-prosemirror-plugins"; export default { services: [ new RulesService(), new ShortCutsService(), + new PluginsService(), new LayoutService(), new MenuService(), new RedoUndoService(), diff --git a/wax-prosemirror-plugins/index.js b/wax-prosemirror-plugins/index.js index b0e89fe7d..325c117be 100644 --- a/wax-prosemirror-plugins/index.js +++ b/wax-prosemirror-plugins/index.js @@ -22,4 +22,5 @@ export { default as RulesService } from "./src/RulesService/RulesService"; export { default as ShortCutsService } from "./src/ShortCutsService/ShortCutsService"; +export { default as PluginsService } from "./src/PluginsService/PluginsService"; export { default as Tool } from "./src/lib/Tools"; diff --git a/wax-prosemirror-plugins/src/RulesService/RulesService.js b/wax-prosemirror-plugins/src/RulesService/RulesService.js index 88b8487fc..bf38d2efa 100644 --- a/wax-prosemirror-plugins/src/RulesService/RulesService.js +++ b/wax-prosemirror-plugins/src/RulesService/RulesService.js @@ -16,7 +16,7 @@ export default class RulesService extends Service { .bind("Rules") .toDynamicValue(() => new Rules(schema, PmPlugins)) .inSingletonScope(); - const configRules = this.config[0].rules; + const configRules = this.config; const rules = this.container.get("Rules"); rules.addRule(configRules); } -- GitLab