From 6ca9d775773af186d43de68863cb77d2cb1902fe Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 1 May 2019 20:46:49 +0200 Subject: [PATCH] Scroll the RTE toolbar if the text component is bigger than the view. Closes #1980 --- src/rich_text_editor/index.js | 6 +++++- webpack.config.js | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/rich_text_editor/index.js b/src/rich_text_editor/index.js index 9eeaa7278..d124bc47c 100644 --- a/src/rich_text_editor/index.js +++ b/src/rich_text_editor/index.js @@ -240,8 +240,12 @@ module.exports = () => { if (pos) { if (config.adjustToolbar) { + const frameOffset = canvas.getCanvasView().getFrameOffset(); // Move the toolbar down when the top canvas edge is reached - if (pos.top <= pos.canvasTop) { + if ( + pos.top <= pos.canvasTop && + !(pos.elementHeight + pos.targetHeight >= frameOffset.height) + ) { pos.top = pos.elementTop + pos.elementHeight; } } diff --git a/webpack.config.js b/webpack.config.js index f5a5107c6..ce1aa9246 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -40,7 +40,10 @@ module.exports = env => { plugins: plugins, mode: isProd ? 'production' : 'development', devtool: isProd ? 'source-map' : (!env ? 'cheap-module-eval-source-map' : false), - devServer: { headers: { 'Access-Control-Allow-Origin': '*' } }, + devServer: { + headers: { 'Access-Control-Allow-Origin': '*' }, + disableHostCheck: true, + }, module: { rules: [{ test: /\/index\.js$/,