From c019ef5cb0c74521d16fbb12b6f86736112e9e8a Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 23 Jul 2021 09:19:11 +0100 Subject: [PATCH] Removed prototype button atom refs https://github.com/TryGhost/Team/issues/931 - prototype button has served it's purpose in answering questions and is no longer being used - groundwork is left in place for future component-based atoms --- .../addon/components/koenig-atom-button.hbs | 21 ---------------- .../addon/components/koenig-atom-button.js | 12 --------- .../lib/koenig-editor/addon/options/atoms.js | 9 +++---- .../addon/options/key-commands.js | 25 ------------------- .../koenig-editor/addon/services/koenig-ui.js | 2 -- .../app/components/koenig-atom-button.js | 1 - 6 files changed, 3 insertions(+), 67 deletions(-) delete mode 100644 ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.hbs delete mode 100644 ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.js delete mode 100644 ghost/admin/lib/koenig-editor/app/components/koenig-atom-button.js diff --git a/ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.hbs b/ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.hbs deleted file mode 100644 index be0daabcfa..0000000000 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.hbs +++ /dev/null @@ -1,21 +0,0 @@ - - {{@atom.value}} - - -{{#if this.isHovered}} - -
  • - -
  • -
    -{{/if}} \ No newline at end of file diff --git a/ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.js b/ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.js deleted file mode 100644 index aa2c962277..0000000000 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-atom-button.js +++ /dev/null @@ -1,12 +0,0 @@ -import Component from '@glimmer/component'; -import {action} from '@ember/object'; -import {tracked} from '@glimmer/tracking'; - -export default class KoenigAtomButtonComponent extends Component { - @tracked isHovered = false; - - @action - deleteButton() { - // noop - } -} diff --git a/ghost/admin/lib/koenig-editor/addon/options/atoms.js b/ghost/admin/lib/koenig-editor/addon/options/atoms.js index 8737f5cfdd..b80232a8dc 100644 --- a/ghost/admin/lib/koenig-editor/addon/options/atoms.js +++ b/ghost/admin/lib/koenig-editor/addon/options/atoms.js @@ -1,11 +1,9 @@ // Atoms are effectively read-only inline cards // Full docs: https://github.com/bustle/mobiledoc-kit/blob/master/ATOMS.md -import createComponentAtom from '../utils/create-component-atom'; +// import createComponentAtom from '../utils/create-component-atom'; -export const ATOM_COMPONENT_MAP = { - button: 'koenig-atom-button' -}; +export const ATOM_COMPONENT_MAP = {}; export default [ // soft-return is triggered by SHIFT+ENTER and allows for line breaks @@ -16,6 +14,5 @@ export default [ render() { return document.createElement('br'); } - }, - createComponentAtom('button') + } ]; diff --git a/ghost/admin/lib/koenig-editor/addon/options/key-commands.js b/ghost/admin/lib/koenig-editor/addon/options/key-commands.js index 67528d7f8c..a064fddd68 100644 --- a/ghost/admin/lib/koenig-editor/addon/options/key-commands.js +++ b/ghost/admin/lib/koenig-editor/addon/options/key-commands.js @@ -419,31 +419,6 @@ export const DEFAULT_KEY_COMMANDS = [{ return false; } -}, { - str: 'META+SHIFT+B', - run(editor, koenig) { - if (!koenig.feature.emailCardSegments || !editor.range.headSection.isMarkerable) { - return; - } - - editor.run((postEditor) => { - const texts = [ - 'Hit me!', - 'Hit me!', - 'Hit me!', - 'Hit me slowly', - 'Hit me quick', - 'Hit me with your rhythm stick!' - ]; - - const buttonText = texts[koenig.koenigUi.buttonCount % texts.length]; - koenig.koenigUi.buttonCount += 1; - - const button = postEditor.builder.createAtom('button', buttonText); - const endPos = postEditor.insertMarkers(editor.range.head, [button]); - postEditor.insertText(endPos, ' '); - }); - } }]; // key commands that are used in koenig-basic-html-input diff --git a/ghost/admin/lib/koenig-editor/addon/services/koenig-ui.js b/ghost/admin/lib/koenig-editor/addon/services/koenig-ui.js index 22579ec203..a2bc5495bc 100644 --- a/ghost/admin/lib/koenig-editor/addon/services/koenig-ui.js +++ b/ghost/admin/lib/koenig-editor/addon/services/koenig-ui.js @@ -6,8 +6,6 @@ export default class KoenigUiService extends Service { @tracked inputHasFocus = false; @tracked isDragging = false; - buttonCount = 0; - #focusedCaption = null; captionGainedFocus(caption) { diff --git a/ghost/admin/lib/koenig-editor/app/components/koenig-atom-button.js b/ghost/admin/lib/koenig-editor/app/components/koenig-atom-button.js deleted file mode 100644 index a2ad2469ac..0000000000 --- a/ghost/admin/lib/koenig-editor/app/components/koenig-atom-button.js +++ /dev/null @@ -1 +0,0 @@ -export {default} from 'koenig-editor/components/koenig-atom-button';