From b439822516c438a4bcb09c102721c9402ea3e405 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Sat, 9 Jan 2021 13:41:07 +0100 Subject: [PATCH] moves from index.html to js --- src/editor/EditorStartup.js | 6 +- src/editor/Rulers.js | 4 +- src/editor/index.html | 17 ----- src/editor/svgedit.css | 93 +------------------------- src/editor/templates/editorTemplate.js | 46 +++++++++++++ src/editor/templates/rulersTemplate.js | 85 +++++++++++++++++++++++ 6 files changed, 140 insertions(+), 111 deletions(-) create mode 100644 src/editor/templates/editorTemplate.js create mode 100644 src/editor/templates/rulersTemplate.js diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index 2a1e6951..7ff44885 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -4,7 +4,7 @@ import {convertUnit} from '../common/units.js'; import { hasCustomHandler, getCustomHandler, injectExtendedContextMenuItemsIntoDom } from './contextmenu.js'; - +import editorTemplate from './templates/editorTemplate.js'; import SvgCanvas from '../svgcanvas/svgcanvas.js'; import LayersPanel from './panels/LayersPanel.js'; import LeftPanelHandlers from './panels/LeftPanelHandlers.js'; @@ -64,7 +64,9 @@ class EditorStartup { // allow to prepare the dom without display $id('svg_editor').style.visibility = 'hidden'; try { - // Image props dialog added to DOM + // add editor components to the DOM + document.body.append(editorTemplate.content.cloneNode(true)); + // Image props dialog added to DOM const newSeImgPropDialog = document.createElement('se-img-prop-dialog'); newSeImgPropDialog.setAttribute('id', 'se-img-prop'); document.body.append(newSeImgPropDialog); diff --git a/src/editor/Rulers.js b/src/editor/Rulers.js index 2bc1e4ad..bae0a3e0 100644 --- a/src/editor/Rulers.js +++ b/src/editor/Rulers.js @@ -1,6 +1,6 @@ /* globals $ */ import {getTypeMap} from '../common/units.js'; - +import rulersTemplate from './templates/rulersTemplate.js'; /** * */ @@ -18,6 +18,8 @@ class Rulers { } this.svgCanvas = editor.svgCanvas; this.editor = editor; + // add rulers component to the DOM + document.body.append(rulersTemplate.content.cloneNode(true)); } /** * @type {Module} diff --git a/src/editor/index.html b/src/editor/index.html index ae415f7b..6b3c185d 100644 --- a/src/editor/index.html +++ b/src/editor/index.html @@ -29,23 +29,6 @@