Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-10 04:12:53 +01:00
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/templates/components/conditional-loading-spinner
|
||||||
//= require discourse/components/d-button
|
//= require discourse/components/d-button
|
||||||
//= require discourse/templates/components/d-button
|
//= require discourse/templates/components/d-button
|
||||||
//= require discourse/components/d-editor-modal
|
|
||||||
//= require lodash.js
|
//= require lodash.js
|
||||||
//= require mousetrap.js
|
//= require mousetrap.js
|
|
@ -68,8 +68,6 @@ class Toolbar {
|
||||||
perform: e => e.applySurround('_', '_', 'italic_text')
|
perform: e => e.applySurround('_', '_', 'italic_text')
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addButton({id: 'link', group: 'insertions', shortcut: 'K', action: 'showLinkModal'});
|
|
||||||
|
|
||||||
this.addButton({
|
this.addButton({
|
||||||
id: 'quote',
|
id: 'quote',
|
||||||
group: 'insertions',
|
group: 'insertions',
|
||||||
|
@ -175,9 +173,6 @@ class Toolbar {
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
classNames: ['d-editor'],
|
classNames: ['d-editor'],
|
||||||
ready: false,
|
ready: false,
|
||||||
insertLinkHidden: true,
|
|
||||||
linkUrl: '',
|
|
||||||
linkText: '',
|
|
||||||
lastSel: null,
|
lastSel: null,
|
||||||
_mouseTrap: null,
|
_mouseTrap: null,
|
||||||
showPreview: false,
|
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() {
|
formatCode() {
|
||||||
const sel = this._getSelected('', { lineVal: true });
|
const sel = this._getSelected('', { lineVal: true });
|
||||||
const selValue = sel.value;
|
const selValue = sel.value;
|
||||||
|
@ -669,29 +654,6 @@ export default Ember.Component.extend({
|
||||||
return this._addText(sel, `${preNewline}\`\`\`\n${sel.value}\n\`\`\`${postNewline}`);
|
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-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'>
|
<div class='d-editor-container'>
|
||||||
{{#if showPreview}}
|
{{#if showPreview}}
|
||||||
<div class="d-editor-preview-wrapper {{if forcePreview 'force-preview'}}">
|
<div class="d-editor-preview-wrapper {{if forcePreview 'force-preview'}}">
|
||||||
|
|
Laden …
In neuem Issue referenzieren