From bdb1d936b98fc70ac134bfda7d579c881b4f7581 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 11 Oct 2019 08:49:20 +1100 Subject: [PATCH] Remove link functionality from editor --- assets/javascripts/wizard-custom.js | 1 - .../wizard/components/wizard-editor.js.es6 | 38 ------------------- .../templates/components/wizard-editor.hbs | 8 ---- 3 files changed, 47 deletions(-) diff --git a/assets/javascripts/wizard-custom.js b/assets/javascripts/wizard-custom.js index 89796a27..0f75892b 100644 --- a/assets/javascripts/wizard-custom.js +++ b/assets/javascripts/wizard-custom.js @@ -39,6 +39,5 @@ //= require discourse/templates/components/conditional-loading-spinner //= require discourse/components/d-button //= require discourse/templates/components/d-button -//= require discourse/components/d-editor-modal //= require lodash.js //= require mousetrap.js \ No newline at end of file diff --git a/assets/javascripts/wizard/components/wizard-editor.js.es6 b/assets/javascripts/wizard/components/wizard-editor.js.es6 index 892b0ff6..cace45c5 100644 --- a/assets/javascripts/wizard/components/wizard-editor.js.es6 +++ b/assets/javascripts/wizard/components/wizard-editor.js.es6 @@ -68,8 +68,6 @@ class Toolbar { perform: e => e.applySurround('_', '_', 'italic_text') }); - this.addButton({id: 'link', group: 'insertions', shortcut: 'K', action: 'showLinkModal'}); - this.addButton({ id: 'quote', group: 'insertions', @@ -175,9 +173,6 @@ class Toolbar { export default Ember.Component.extend({ classNames: ['d-editor'], ready: false, - insertLinkHidden: true, - linkUrl: '', - linkText: '', lastSel: null, _mouseTrap: null, showPreview: false, @@ -631,16 +626,6 @@ export default Ember.Component.extend({ } }, - showLinkModal() { - this._lastSel = this._getSelected(); - - if (this._lastSel) { - this.set("linkText", this._lastSel.value.trim()); - } - - this.set('insertLinkHidden', false); - }, - formatCode() { const sel = this._getSelected('', { lineVal: true }); const selValue = sel.value; @@ -669,29 +654,6 @@ export default Ember.Component.extend({ return this._addText(sel, `${preNewline}\`\`\`\n${sel.value}\n\`\`\`${postNewline}`); } } - }, - - insertLink() { - const origLink = this.get('linkUrl'); - const linkUrl = (origLink.indexOf('://') === -1) ? `http://${origLink}` : origLink; - const sel = this._lastSel; - - if (Ember.isEmpty(linkUrl)) { return; } - - const linkText = this.get('linkText') || ''; - if (linkText.length) { - this._addText(sel, `[${linkText}](${linkUrl})`); - } else { - if (sel.value) { - this._addText(sel, `[${sel.value}](${linkUrl})`); - } else { - this._addText(sel, `[${origLink}](${linkUrl})`); - this._selectText(sel.start + 1, origLink.length); - } - } - - this.set('linkUrl', ''); - this.set('linkText', ''); } } }); diff --git a/assets/javascripts/wizard/templates/components/wizard-editor.hbs b/assets/javascripts/wizard/templates/components/wizard-editor.hbs index 4b45a3db..13fbcc3a 100644 --- a/assets/javascripts/wizard/templates/components/wizard-editor.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-editor.hbs @@ -1,13 +1,5 @@ -
- {{#d-editor-modal class="insert-link" hidden=insertLinkHidden okAction="insertLink"}} -

{{i18n "wizard_composer.link_dialog_title"}}

- {{wizard-text-field value=linkUrl placeholderKey="wizard_composer.link_url_placeholder" class="link-url"}} - {{wizard-text-field value=linkText placeholderKey="wizard_composer.link_optional_text" class="link-text"}} - {{/d-editor-modal}} -
-
{{#if showPreview}}