X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/921131f99949960f448b2cfbb0ad78edc8d4f24a..refs/pull/4467/head:/resources/js/wysiwyg/scrolling.js diff --git a/resources/js/wysiwyg/scrolling.js b/resources/js/wysiwyg/scrolling.js index 360d18381..92f8f1583 100644 --- a/resources/js/wysiwyg/scrolling.js +++ b/resources/js/wysiwyg/scrolling.js @@ -1,31 +1,3 @@ -/** - * Scroll to a section dictated by the current URL query string, if present. - * Used when directly editing a specific section of the page. - * @param {Editor} editor - */ -export function scrollToQueryString(editor) { - const queryParams = (new URL(window.location)).searchParams; - const scrollId = queryParams.get('content-id'); - if (scrollId) { - scrollToText(editor, scrollId); - } -} - -/** - * Override for touch events to allow scrolling on mobile devices. - * TODO - Check if still needed or if needs editing. - * @param {Editor} editor - */ -export function fixScrollForMobile(editor) { - const container = editor.getContainer(); - const toolbarButtons = container.querySelectorAll('.mce-btn'); - for (let button of toolbarButtons) { - button.addEventListener('touchstart', event => { - event.stopPropagation(); - }); - } -} - /** * @param {Editor} editor * @param {String} scrollId @@ -41,4 +13,17 @@ function scrollToText(editor, scrollId) { editor.selection.select(element, true); editor.selection.collapse(false); editor.focus(); -} \ No newline at end of file +} + +/** + * Scroll to a section dictated by the current URL query string, if present. + * Used when directly editing a specific section of the page. + * @param {Editor} editor + */ +export function scrollToQueryString(editor) { + const queryParams = (new URL(window.location)).searchParams; + const scrollId = queryParams.get('content-id'); + if (scrollId) { + scrollToText(editor, scrollId); + } +}