diff --git a/app/apps/core/static/js/edit/components/seg_panel.js b/app/apps/core/static/js/edit/components/seg_panel.js index a24f05c3aa4169633952e3165b76ceefc77dd005..1da2ad0bd5edcf867f393cc550bafe1e07807d26 100644 --- a/app/apps/core/static/js/edit/components/seg_panel.js +++ b/app/apps/core/static/js/edit/components/seg_panel.js @@ -65,7 +65,6 @@ const SegPanel = BasePanel.extend({ // same event for creation and modification of a line/region let data = ev.detail; this.extractPrevious(data); - let toCreate = { lines: data.lines && data.lines.filter(l=>l.context.pk===null) || [], regions: data.regions && data.regions.filter(l=>l.context.pk===null) || [] @@ -85,7 +84,7 @@ const SegPanel = BasePanel.extend({ }); }.bind(this), function() { // redo - this.bulkCreate(toCreate, createInEditor=true) + this.bulkCreate(toCreate, createInEditor=true); this.bulkUpdate(toUpdate); }.bind(this) ); @@ -209,7 +208,8 @@ const SegPanel = BasePanel.extend({ this.$parent.$emit( 'create:region', { pk: data.regions[i].pk, - box: data.regions[i].box + box: data.regions[i].box, + type: data.regions[i].type }, function(region) { if (createInEditor) { this.segmenter.loadRegion(region); diff --git a/app/apps/core/static/js/edit/store/part.js b/app/apps/core/static/js/edit/store/part.js index d5b285e33785271e4a2ed5e273bb3b472aac29ed..7757e0826325576694a36ed989ab3f207735d0c1 100644 --- a/app/apps/core/static/js/edit/store/part.js +++ b/app/apps/core/static/js/edit/store/part.js @@ -339,8 +339,10 @@ const partStore = { createRegion(region, callback) { let uri = this.getApiPart() + 'blocks/'; + let type = region.type && this.types.regions.find(t=>t.name==region.type); data = { document_part: this.pk, + typology: type && type.pk || null, box: region.box }; this.push(uri, data, method="post") diff --git a/app/escriptorium/static/js/baseline.editor.js b/app/escriptorium/static/js/baseline.editor.js index 70912bd7d8c7ededb57c897290bac9ea904e9334..83d93059a43049da25326a10df70410789f0c9c0 100644 --- a/app/escriptorium/static/js/baseline.editor.js +++ b/app/escriptorium/static/js/baseline.editor.js @@ -1701,6 +1701,9 @@ class Segmenter { } else { this.regionTypesSelect.value = 'None'; } + } else { + // avoid unbinding keyboard then + return; } var self = this; // mandatory for unbinding @@ -1999,7 +2002,8 @@ class Segmenter { region.polygonPath.removeSegments(); coumpound.children[0].segments.forEach(s=>region.polygonPath.add(s)); for (let i=1;i<coumpound.children.length;i++) { - let newRegion = this.createRegion(null, coumpound.children[i].segments, region.type, null, false); + let newRegion = this.createRegion(null, coumpound.children[i].segments, + region.type, null, false); newRegion.updateDataFromCanvas(); coumpound.children[i].remove(); }