Skip to content

Commit

Permalink
Continues Inline edit
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausSchaefers committed Jun 20, 2024
1 parent 5c93fed commit 4dff4da
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/canvas/InlineEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export default {
this._inlineEditDiv = div;
this._inlineEditResizeToWidth = resizeToWidth
this._inlineFocus(null, false, resizeToWidth);
const dndDiv = this.widgetDivs[widget.id]
if (dndDiv) {
this._inlineEditDnDDiv = dndDiv
css.add(dndDiv, 'MatcDnDLayerSelectet')
}
}
},
Expand Down Expand Up @@ -57,7 +63,7 @@ export default {
},
inlineEditStop (){
this.logger.log(2,"inlineEditStop", "enter", this._inlineEditResizeToWidth);
this.logger.log(-2,"inlineEditStop", "enter", this._inlineEditResizeToWidth);
if(this._inlineEditWidget && this._inlineEditStarted){
const div = this.renderFactory.getLabelNode(this._inlineEditWidget);
Expand All @@ -75,6 +81,7 @@ export default {
txt = txt.replace(/%/g, "$perc;"); // Mongo cannot deal with % on undo
const resizeToWidth = this._inlineEditResizeToWidth
this._inlineEditLastStop = new Date().getTime()
// only chnag ethe widget label when there was a real change, or
// we need to resize (because we a created a new widget with default message)
Expand Down Expand Up @@ -105,13 +112,15 @@ export default {
} else {
this.controller.updateWidgetProperties(id, {label : txt}, "props", true);
}
return txt;
} else {
this.logger.log(3,"inlineEditStop", "exit > no chnage!");
}
}
}
this.cleanUpInlineEdit();
this.clearInlineEditSelections()
},
Expand Down Expand Up @@ -209,6 +218,10 @@ export default {
this._inlineCopyEventListener.remove()
}
if (this._inlineEditDnDDiv) {
css.remove(this._inlineEditDnDDiv, 'MatcDnDLayerSelectet')
}
if(this._inlineEditDiv){
domAttr.set(this._inlineEditDiv, "contenteditable", false);
this._inlineEditDiv.setAttribute("contentEditable", false);
Expand All @@ -226,9 +239,10 @@ export default {
this._inlineMouseUp.remove();
this._inlineMouseUp = null;
}
this._inlineEditWidget = null;
this._inlineInnerHTML = null;
this._inlineEditDnDDiv = null
this._inlineEditStarted = false;
this._inlineEditResizeToWidth = false
Expand Down
8 changes: 7 additions & 1 deletion src/canvas/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ import * as SelectionUtil from 'core/SelectionUtil'
onWidgetSelected (id, forceSelection = false, ignoreParentGroups = null){
this.logger.log(1,"onWidgetSelected", "enter > "+ id + " > ignoreParentGroups : "+ ignoreParentGroups);
this.logger.log(-1,"onWidgetSelected", "enter > "+ id + " > ignoreParentGroups : "+ ignoreParentGroups);
const now = new Date().getTime()
/**
* Check here if the widget was select a second time. In this case
Expand Down Expand Up @@ -219,6 +221,10 @@ import * as SelectionUtil from 'core/SelectionUtil'
this.selectDnDBox(id);
}
this.controller.onWidgetSelected(id);
if ((now - this._inlineEditLastStop) < 300) {
this.inlineEditInit(this._selectWidget)
}
} else {
console.warn("onWidgetSelected() > No widget with id", id);
}
Expand Down
9 changes: 9 additions & 0 deletions src/style/canvas/canvas.scss
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,15 @@
pointer-events: none;
}

.MatcCanvasModeInlineEdit .MatcDnDLayer .MatcWidgetDND {
pointer-events: all;
}

.MatcCanvasModeInlineEdit .MatcDnDLayer .MatcDnDLayerSelectet {
pointer-events: none;
}


.MatcCanvasModeInlineEdit .MatcResizeBorderDown {
border-bottom: 1px dashed $canvas_selection;
}
Expand Down

0 comments on commit 4dff4da

Please sign in to comment.