Browse Source

Add inAbsoluteMode to editor model

pull/2062/head
Artur Arseniev 7 years ago
parent
commit
7795cd9e0c
  1. 7
      src/block_manager/view/BlockView.js
  2. 8
      src/editor/model/Editor.js

7
src/block_manager/view/BlockView.js

@ -60,10 +60,10 @@ module.exports = Backbone.View.extend({
* @private
*/
startDrag(e) {
const config = this.config;
const { config, em } = this;
//Right or middel click
if (e.button !== 0 || !config.getSorter || this.el.draggable) return;
config.em.refreshCanvas();
em.refreshCanvas();
const sorter = config.getSorter();
sorter.setDragHelper(this.el, e);
sorter.setDropContent(this.model.get('content'));
@ -75,11 +75,10 @@ module.exports = Backbone.View.extend({
const { em, model } = this;
const content = model.get('content');
const isObj = isObject(content);
const type = isObj ? 'text/json' : 'text';
const data = isObj ? JSON.stringify(content) : content;
// Note: data are not available on dragenter for security reason,
// but will use dragContent as I need it for the Sorter context
// we have to use dragContent as we need it for the Sorter context
// IE11 supports only 'text' data type
ev.dataTransfer.setData('text', data);
em.set('dragContent', content);

8
src/editor/model/Editor.js

@ -625,6 +625,14 @@ module.exports = Backbone.Model.extend({
return this.get('Canvas').getZoomDecimal();
},
/**
* Returns true if the editor is in absolute mode
* @returns {Boolean}
*/
inAbsoluteMode() {
return this.get('dmode') === 'absolute';
},
/**
* Destroy editor
*/

Loading…
Cancel
Save