Merge branch 'master' of https://github.com/angusmcleod/discourse-custom-wizard into juless_extensions
Dieser Commit ist enthalten in:
Commit
fc602db262
3 geänderte Dateien mit 0 neuen und 47 gelöschten Zeilen
|
@ -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
|
|
@ -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', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
<div class='d-editor-overlay hidden'></div>
|
||||
|
||||
<div class='d-editor-modals'>
|
||||
{{#d-editor-modal class="insert-link" hidden=insertLinkHidden okAction="insertLink"}}
|
||||
<h3>{{i18n "wizard_composer.link_dialog_title"}}</h3>
|
||||
{{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}}
|
||||
</div>
|
||||
|
||||
<div class='d-editor-container'>
|
||||
{{#if showPreview}}
|
||||
<div class="d-editor-preview-wrapper {{if forcePreview 'force-preview'}}">
|
||||
|
|
Laden …
In neuem Issue referenzieren