diff --git a/src/canvas/config/config.js b/src/canvas/config/config.js index b1e6f8b46..ac36ef9f2 100644 --- a/src/canvas/config/config.js +++ b/src/canvas/config/config.js @@ -38,10 +38,26 @@ export default { // Experimental: external highlighter box extHl: 0, + /** + * Initial content to load in all frames. + * The default value enables the standard mode for the iframe. + */ + frameContent: '', + + /** + * Initial style to load in all frames. + */ + frameStyle: ` + body { background-color: #fff } + * ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1) } + * ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2) } + * ::-webkit-scrollbar { width: 10px } + `, + /** * When some textable component is selected and focused (eg. input or text component) the editor * stops some commands (eg. disables the copy/paste of components with CTRL+C/V to allow the copy/paste of the text). * This option allows to customize, by a selector, which element should not be considered textable */ - notTextable: ['button', 'a', 'input[type=checkbox]', 'input[type=radio]'] + notTextable: ['button', 'a', 'input[type=checkbox]', 'input[type=radio]'], }; diff --git a/src/canvas/view/FrameView.js b/src/canvas/view/FrameView.js index f68b70a2a..44df56c16 100644 --- a/src/canvas/view/FrameView.js +++ b/src/canvas/view/FrameView.js @@ -268,6 +268,13 @@ export default class FrameView extends View { }; el.onload = () => { + const { frameContent } = this.config; + if (frameContent) { + const doc = this.getDoc(); + doc.open(); + doc.write(frameContent); + doc.close(); + } em && em.trigger(`${evLoad}:before`, evOpts); appendScript([...canvas.get('scripts')]); }; @@ -316,18 +323,15 @@ export default class FrameView extends View { const colorWarn = '#ffca6f'; - // I need all this styles to make the editor work properly - // Remove `html { height: 100%;}` from the baseCss as it gives jumpings - // effects (on ENTER) with RTE like CKEditor (maybe some bug there?!?) - // With `body {height: auto;}` jumps in CKEditor are removed but in - // Firefox is impossible to drag stuff in empty canvas, so bring back - // `body {height: 100%;}`. - // For the moment I give the priority to Firefox as it might be - // CKEditor's issue append( body, `