mirror of https://github.com/artf/grapesjs.git
committed by
GitHub
38 changed files with 1430 additions and 265 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,67 +1,65 @@ |
|||
import _ from 'underscore'; |
|||
import { each } from 'underscore'; |
|||
|
|||
module.exports = { |
|||
getPanels(editor) { |
|||
if (!this.panels) this.panels = editor.Panels.getPanelsEl(); |
|||
if (!this.panels) { |
|||
this.panels = editor.Panels.getPanelsEl(); |
|||
} |
|||
|
|||
return this.panels; |
|||
}, |
|||
|
|||
tglPointers(editor, v) { |
|||
var elP = editor.Canvas.getBody().querySelectorAll( |
|||
'.' + this.ppfx + 'no-pointer' |
|||
); |
|||
_.each(elP, item => { |
|||
item.style.pointerEvents = v ? '' : 'all'; |
|||
}); |
|||
tglPointers(editor, val) { |
|||
const body = editor.Canvas.getBody(); |
|||
const elP = body.querySelectorAll(`.${this.ppfx}no-pointer`); |
|||
each(elP, item => (item.style.pointerEvents = val ? '' : 'all')); |
|||
}, |
|||
|
|||
run(editor, sender) { |
|||
if (sender && sender.set) sender.set('active', false); |
|||
this.sender = sender; |
|||
editor.stopCommand('sw-visibility'); |
|||
editor.getModel().stopDefault(); |
|||
var that = this; |
|||
var panels = this.getPanels(editor); |
|||
var canvas = editor.Canvas.getElement(); |
|||
var editorEl = editor.getEl(); |
|||
var pfx = editor.Config.stylePrefix; |
|||
const panels = this.getPanels(editor); |
|||
const canvas = editor.Canvas.getElement(); |
|||
const editorEl = editor.getEl(); |
|||
const pfx = editor.Config.stylePrefix; |
|||
|
|||
if (!this.helper) { |
|||
this.helper = document.createElement('span'); |
|||
this.helper.className = pfx + 'off-prv fa fa-eye-slash'; |
|||
editorEl.appendChild(this.helper); |
|||
this.helper.onclick = () => { |
|||
editor.stopCommand('preview'); |
|||
}; |
|||
const helper = document.createElement('span'); |
|||
helper.className = `${pfx}off-prv fa fa-eye-slash`; |
|||
editorEl.appendChild(helper); |
|||
helper.onclick = () => editor.stopCommand('preview'); |
|||
this.helper = helper; |
|||
} |
|||
|
|||
this.helper.style.display = 'inline-block'; |
|||
this.tglPointers(editor); |
|||
|
|||
/* |
|||
editor.Canvas.getBody().querySelectorAll('.' + pfx + 'no-pointer').forEach(function(){ |
|||
this.style.pointerEvents = 'all'; |
|||
});*/ |
|||
|
|||
panels.style.display = 'none'; |
|||
var canvasS = canvas.style; |
|||
const canvasS = canvas.style; |
|||
canvasS.width = '100%'; |
|||
canvasS.height = '100%'; |
|||
canvasS.top = '0'; |
|||
canvasS.left = '0'; |
|||
canvasS.padding = '0'; |
|||
canvasS.margin = '0'; |
|||
editor.trigger('change:canvasOffset'); |
|||
editor.refresh(); |
|||
}, |
|||
|
|||
stop(editor, sender) { |
|||
var panels = this.getPanels(editor); |
|||
stop(editor) { |
|||
const { sender = {} } = this; |
|||
sender.set && sender.set('active', 0); |
|||
const panels = this.getPanels(editor); |
|||
editor.runCommand('sw-visibility'); |
|||
editor.getModel().runDefault(); |
|||
panels.style.display = 'block'; |
|||
var canvas = editor.Canvas.getElement(); |
|||
panels.style.display = ''; |
|||
const canvas = editor.Canvas.getElement(); |
|||
canvas.setAttribute('style', ''); |
|||
|
|||
if (this.helper) { |
|||
this.helper.style.display = 'none'; |
|||
} |
|||
editor.trigger('change:canvasOffset'); |
|||
|
|||
editor.refresh(); |
|||
this.tglPointers(editor, 1); |
|||
} |
|||
}; |
|||
|
|||
@ -1 +1,8 @@ |
|||
module.exports = require('backbone').View.extend({}); |
|||
module.exports = require('backbone').View.extend({ |
|||
initialize() { |
|||
this.model.view = this; |
|||
}, |
|||
_createElement() { |
|||
return document.createTextNode(this.model.get('content')); |
|||
} |
|||
}); |
|||
|
|||
Loading…
Reference in new issue