Browse Source

Add setDragMode to editor

pull/2190/head
Artur Arseniev 7 years ago
parent
commit
74e39c7ec6
  1. 7
      src/editor/config/config.js
  2. 11
      src/editor/index.js
  3. 4
      src/editor/model/Editor.js

7
src/editor/config/config.js

@ -140,6 +140,13 @@ export default {
// use it later, but this option comes really handy when deal with big templates.
clearStyles: 0,
// Specify the global drag mode of components. By default, components are moved
// following the HTML flow. Two other options are available:
// 'absolute' - Move components absolutely (design tools way)
// 'translate' - Use translate CSS from transform property
// To get more about this feature read: https://github.com/artf/grapesjs/issues/1936
dragMode: 0,
// Dom element
el: '',

11
src/editor/index.js

@ -617,6 +617,17 @@ export default (config = {}) => {
return this;
},
/**
* Change the global drag mode of components.
* To get more about this feature read: https://github.com/artf/grapesjs/issues/1936
* @param {String} value Drag mode, options: 'absolute' | 'translate'
* @returns {this}
*/
setDragMode(value) {
em.setDragMode(value);
return this;
},
/**
* Trigger event log message
* @param {*} msg Message to log

4
src/editor/model/Editor.js

@ -624,6 +624,10 @@ export default Backbone.Model.extend({
return this.get('Canvas').getZoomDecimal();
},
setDragMode(value) {
return this.set('dmode', value);
},
/**
* Returns true if the editor is in absolute mode
* @returns {Boolean}

Loading…
Cancel
Save