0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

Merge branch 'main' into pro-release

Dieser Commit ist enthalten in:
Angus McLeod 2022-05-13 11:42:50 +02:00
Commit 3e2faaa264
5 geänderte Dateien mit 11 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -78,16 +78,9 @@ export default Component.extend({
let params = setWizardDefaults({}, itemType);
params.isNew = true;
params.index = items.length;
let index = 0;
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}`;
let id = `${itemType}_${params.index + 1}`;
if (itemType === "field") {
id = `${this.parentId}_${id}`;
}

Datei anzeigen

@ -64,13 +64,13 @@ export default {
_wizardInsertText(args = {}) {
if (args.fieldId === this.fieldId) {
this._insertText(args.text, args.options);
this.insertText(args.text, args.options);
}
},
_wizardReplaceText(args = {}) {
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 handled = false;
const { pre, lineVal } = this._getSelected(null, { lineVal: true });
const { pre, lineVal } = this.getSelected(null, { lineVal: true });
const isInlinePasting = pre.match(/[^\n]$/);
const isCodeBlock = isInside(pre, /(^|\n)```/g);
@ -100,7 +100,7 @@ export default {
!isCodeBlock
) {
plainText = plainText.trim().replace(/\r/g, "");
const table = this._extractTable(plainText);
const table = this.extractTable(plainText);
if (table) {
this.appEvents.trigger("wizard-editor:insert-text", {
fieldId: this.fieldId,

Datei anzeigen

@ -498,7 +498,6 @@ $error: #ef1700;
}
.d-editor-textarea-wrapper {
display: grid;
margin-bottom: 10px;
textarea {

Datei anzeigen

@ -259,12 +259,12 @@ describe CustomWizard::CustomField do
expect(CustomWizard::CustomField.list_by(:serializers, ['post']).length).to eq(0)
end
it "custom field records added by other plugins " do
expect(CustomWizard::CustomField.external_list.length).to be > 10
it "lists custom field records added by other plugins " do
expect(CustomWizard::CustomField.external_list.length).to eq(8)
end
it "all custom field records" do
expect(CustomWizard::CustomField.full_list.length).to be > 12
it "lists all custom field records" do
expect(CustomWizard::CustomField.full_list.length).to eq(12)
end
end

Datei anzeigen

@ -13,7 +13,7 @@ describe CustomWizard::AdminCustomFieldsController do
it "returns the full list of custom fields" do
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
it "saves custom fields" do