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
This commit is contained in:
Kevin Ansfield 2021-07-23 09:19:11 +01:00
parent 039803b29d
commit c019ef5cb0
6 changed files with 3 additions and 67 deletions

View File

@ -1,21 +0,0 @@
<a href="https://ghost.org" class="gh-btn"
{{on "mouseover" (fn (mut this.isHovered) true)}}
{{on "mouseleave" (fn (mut this.isHovered) false)}}
>
<span>{{@atom.value}}</span>
</a>
{{#if this.isHovered}}
<KgActionBar @class="absolute" @style={{this.toolbarStyle}} @isVisible={{true}} @instantClose={{this.koenigUi.inputHasFocus}}>
<li class="ma0 lh-solid">
<button
type="button"
title="Delete button"
class="dib dim-lite link h9 w9 nudge-top--1 justify-center"
{{on "click" this.deleteButton}}
>
{{svg-jar "koenig/kg-trash" class="fill-white w4 h4"}}
</button>
</li>
</KgActionBar>
{{/if}}

View File

@ -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
}
}

View File

@ -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')
}
];

View File

@ -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

View File

@ -6,8 +6,6 @@ export default class KoenigUiService extends Service {
@tracked inputHasFocus = false;
@tracked isDragging = false;
buttonCount = 0;
#focusedCaption = null;
captionGainedFocus(caption) {

View File

@ -1 +0,0 @@
export {default} from 'koenig-editor/components/koenig-atom-button';