Skip to content

Commit

Permalink
Field type Table: Copy / Paste (#715)
Browse files Browse the repository at this point in the history
* field type table: copy-paste: after paste, allow to modify pasted data before applying to table + save changes

* field type table: copy-paste: after paste, allow to modify pasted data before applying to table + save changes

* field type table: copy-paste: after paste, allow to modify pasted data before applying to table
  • Loading branch information
BlackbitDevs authored Oct 25, 2024
1 parent 6f42e54 commit 0da7951
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions public/js/pimcore/object/tags/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,30 +451,7 @@ pimcore.object.tags.table = Class.create(pimcore.object.tags.abstract, {
width: '100%',
emptyText: t("paste_here"),
validateOnChange: false,
enableKeyEvents: true,
listeners: {
change: function(){
var value = this.pasteField.getValue();
if (value) {

var lines = value.split("\n");

var result = [];

if (lines) {
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
line = line.split("\t");
result.push(line);
}
this.dirty = true;
}
}

this.initStore(result);
this.pasteWindow.close();
}.bind(this)
}
enableKeyEvents: true
});

this.pasteWindow = new Ext.Window({
Expand All @@ -491,6 +468,31 @@ pimcore.object.tags.table = Class.create(pimcore.object.tags.abstract, {
this.pasteField,
],
buttons: [
{
text: t("save"),
iconCls: "pimcore_icon_save",
handler: function () {
let value = this.pasteField.getValue();

if (value) {
let lines = value.split("\n");
let result = [];

if (lines) {
for (let i = 0; i < lines.length; i++) {
let line = lines[i];
line = line.split("\t");
result.push(line);
}

this.dirty = true;
}
this.initStore(result);
}

this.pasteWindow.close();
}.bind(this)
},
{
text: t("cancel"),
iconCls: "pimcore_icon_cancel",
Expand Down

0 comments on commit 0da7951

Please sign in to comment.