0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00

Merge branch 'master' into fix-redirect-after-login

Dieser Commit ist enthalten in:
Angus McLeod 2019-10-14 11:04:46 +11:00
Commit a3ccbe6a4e
4 geänderte Dateien mit 1 neuen und 47 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -15,6 +15,7 @@ config.assets.paths << Rails.root.join('plugins', 'discourse-custom-wizard', 'as
if Rails.env.production?
config.assets.precompile += %w{
wizard-custom-guest.js
wizard-custom-lib.js
wizard-custom.js
wizard-plugin.js