Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-10 04:12:53 +01:00
Merge branch 'main' into pro-release
Dieser Commit ist enthalten in:
Commit
3e2faaa264
5 geänderte Dateien mit 11 neuen und 19 gelöschten Zeilen
|
@ -78,16 +78,9 @@ export default Component.extend({
|
||||||
let params = setWizardDefaults({}, itemType);
|
let params = setWizardDefaults({}, itemType);
|
||||||
|
|
||||||
params.isNew = true;
|
params.isNew = true;
|
||||||
|
params.index = items.length;
|
||||||
|
|
||||||
let index = 0;
|
let id = `${itemType}_${params.index + 1}`;
|
||||||
if (items.length) {
|
|
||||||
let last_item = items[items.length - 1];
|
|
||||||
index = Number(last_item.id.split("_").pop());
|
|
||||||
}
|
|
||||||
|
|
||||||
params.index = index;
|
|
||||||
|
|
||||||
let id = `${itemType}_${index + 1}`;
|
|
||||||
if (itemType === "field") {
|
if (itemType === "field") {
|
||||||
id = `${this.parentId}_${id}`;
|
id = `${this.parentId}_${id}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,13 +64,13 @@ export default {
|
||||||
|
|
||||||
_wizardInsertText(args = {}) {
|
_wizardInsertText(args = {}) {
|
||||||
if (args.fieldId === this.fieldId) {
|
if (args.fieldId === this.fieldId) {
|
||||||
this._insertText(args.text, args.options);
|
this.insertText(args.text, args.options);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_wizardReplaceText(args = {}) {
|
_wizardReplaceText(args = {}) {
|
||||||
if (args.fieldId === this.fieldId) {
|
if (args.fieldId === this.fieldId) {
|
||||||
this._replaceText(args.oldVal, args.newVal, (args.opts = {}));
|
this.replaceText(args.oldVal, args.newVal, (args.opts = {}));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ export default {
|
||||||
let html = clipboard.getData("text/html");
|
let html = clipboard.getData("text/html");
|
||||||
let handled = false;
|
let handled = false;
|
||||||
|
|
||||||
const { pre, lineVal } = this._getSelected(null, { lineVal: true });
|
const { pre, lineVal } = this.getSelected(null, { lineVal: true });
|
||||||
const isInlinePasting = pre.match(/[^\n]$/);
|
const isInlinePasting = pre.match(/[^\n]$/);
|
||||||
const isCodeBlock = isInside(pre, /(^|\n)```/g);
|
const isCodeBlock = isInside(pre, /(^|\n)```/g);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ export default {
|
||||||
!isCodeBlock
|
!isCodeBlock
|
||||||
) {
|
) {
|
||||||
plainText = plainText.trim().replace(/\r/g, "");
|
plainText = plainText.trim().replace(/\r/g, "");
|
||||||
const table = this._extractTable(plainText);
|
const table = this.extractTable(plainText);
|
||||||
if (table) {
|
if (table) {
|
||||||
this.appEvents.trigger("wizard-editor:insert-text", {
|
this.appEvents.trigger("wizard-editor:insert-text", {
|
||||||
fieldId: this.fieldId,
|
fieldId: this.fieldId,
|
||||||
|
|
|
@ -498,7 +498,6 @@ $error: #ef1700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.d-editor-textarea-wrapper {
|
.d-editor-textarea-wrapper {
|
||||||
display: grid;
|
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
|
|
|
@ -259,12 +259,12 @@ describe CustomWizard::CustomField do
|
||||||
expect(CustomWizard::CustomField.list_by(:serializers, ['post']).length).to eq(0)
|
expect(CustomWizard::CustomField.list_by(:serializers, ['post']).length).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "custom field records added by other plugins " do
|
it "lists custom field records added by other plugins " do
|
||||||
expect(CustomWizard::CustomField.external_list.length).to be > 10
|
expect(CustomWizard::CustomField.external_list.length).to eq(8)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "all custom field records" do
|
it "lists all custom field records" do
|
||||||
expect(CustomWizard::CustomField.full_list.length).to be > 12
|
expect(CustomWizard::CustomField.full_list.length).to eq(12)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe CustomWizard::AdminCustomFieldsController do
|
||||||
|
|
||||||
it "returns the full list of custom fields" do
|
it "returns the full list of custom fields" do
|
||||||
get "/admin/wizards/custom-fields.json"
|
get "/admin/wizards/custom-fields.json"
|
||||||
expect(response.parsed_body["custom_fields"].length).to be > 12
|
expect(response.parsed_body.length).to eq(12)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "saves custom fields" do
|
it "saves custom fields" do
|
||||||
|
|
Laden …
In neuem Issue referenzieren