diff --git a/demo/demo-dev.html b/demo/demo-dev.html index ce5add4739..0d6fc98e69 100644 --- a/demo/demo-dev.html +++ b/demo/demo-dev.html @@ -41,7 +41,7 @@ height: '100%', initialEditType: 'wysiwyg', useCommandShortcut: true, - exts: ['scrollFollow', 'colorSyntax', 'uml', 'chart', 'mark', 'table', 'taskCounter'] + exts: ['scrollSync', 'colorSyntax', 'uml', 'chart', 'mark', 'table', 'taskCounter'] }); diff --git a/demo/demo-scrollfollow.html b/demo/demo-scrollsync.html similarity index 94% rename from demo/demo-scrollfollow.html rename to demo/demo-scrollsync.html index 8dfcd51331..653593889d 100644 --- a/demo/demo-scrollfollow.html +++ b/demo/demo-scrollsync.html @@ -31,13 +31,13 @@
- + diff --git a/demo/demo-uml-viewer.html b/demo/demo-uml-viewer.html index 633fc16a2a..873f9a2947 100644 --- a/demo/demo-uml-viewer.html +++ b/demo/demo-uml-viewer.html @@ -60,7 +60,7 @@ ].join('\n'); $('#editSection').tuiEditorViewer({ initialValue: content, - exts: ['scrollFollow', { + exts: ['scrollSync', { name: 'uml', // enable plant uml plugin rendererURL: 'http://www.plantuml.com/plantuml/png/' }] diff --git a/src/css/tui-editor.css b/src/css/tui-editor.css index c9a2683bb7..bba82df7c1 100644 --- a/src/css/tui-editor.css +++ b/src/css/tui-editor.css @@ -300,22 +300,22 @@ margin-right: 0; } -.tui-editor-defaultUI-toolbar button.tui-scrollfollow { +.tui-editor-defaultUI-toolbar button.tui-scrollsync { width: auto; color: #777777; border: 0; } -.tui-editor-defaultUI button.tui-scrollfollow:after { +.tui-editor-defaultUI button.tui-scrollsync:after { content: "Scroll off"; } -.tui-editor-defaultUI button.tui-scrollfollow.active { +.tui-editor-defaultUI button.tui-scrollsync.active { color: #125de6; font-weight: bold; } -.tui-editor-defaultUI button.tui-scrollfollow.active:after { +.tui-editor-defaultUI button.tui-scrollsync.active:after { content: "Scroll on"; } @@ -1112,16 +1112,16 @@ overflow-y: auto; } -.tui-split-scroll button.tui-scrollfollow { +.tui-split-scroll button.tui-scrollsync { top: 10px; opacity: 0.2; } -.tui-split-scroll button.tui-scrollfollow::after { +.tui-split-scroll button.tui-scrollsync::after { content: "scroll off"; } -.tui-split-scroll.scroll-sync button.tui-scrollfollow { +.tui-split-scroll.scroll-sync button.tui-scrollsync { opacity: 0.5; } @@ -1131,7 +1131,7 @@ overflow: initial; } -.tui-split-scroll.scroll-sync button.tui-scrollfollow::after { +.tui-split-scroll.scroll-sync button.tui-scrollsync::after { content: "scroll on"; } @@ -1151,7 +1151,7 @@ display: none; } -.tui-split-scroll.single-content button.tui-scrollfollow { +.tui-split-scroll.single-content button.tui-scrollsync { display: none; } diff --git a/src/js/codemirror/markdown.js b/src/js/codemirror/markdown.js index adb44d847f..46cb905dca 100644 --- a/src/js/codemirror/markdown.js +++ b/src/js/codemirror/markdown.js @@ -35,7 +35,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { modeCfg.underscoresBreakWords = true; // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 // Use `fencedCodeBlocks` to configure fenced code blocks. false to // disable, string to specify a precise regexp that the fence should @@ -76,7 +76,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { , olRE = /^[0-9]+([.)])\s+/ , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/ , setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/ @@ -99,7 +99,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { } // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 function lineIsEmpty(line) { return !line || !/\S/.test(line.string) @@ -129,7 +129,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { state.trailingSpace = 0; state.trailingSpaceNewLine = false; // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 // Mark this line as blank state.prevLine = state.thisLine @@ -176,7 +176,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { if (state.indentationDiff >= 4) { stream.skipToEnd(); // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) { // if (prevLineIsIndentedCode || !state.prevLineHasContent) { @@ -195,7 +195,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { state.f = state.inline; return getType(state); // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 } else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList && !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) { @@ -216,7 +216,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { state.hr = true; return hr; // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) { // } else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) { @@ -229,7 +229,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { listType = 'ol'; } // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 // Roll back to original #1002 // https://github.nhnent.com/fe/tui.editor/issues/1002 @@ -250,7 +250,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType]; return getType(state); // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 } else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) { state.fencedChars = match[1] @@ -284,7 +284,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { function local(stream, state) { // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 if (stream.sol() && state.fencedChars && stream.match(state.fencedChars, false)) { // if (stream.sol() && stream.match("```", false)) { @@ -302,7 +302,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { function leavingLocal(stream, state) { // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 stream.match(state.fencedChars); state.block = blockNormal; @@ -750,7 +750,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return { f: blockNormal, // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 prevLine: null, thisLine: null, @@ -786,7 +786,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { trailingSpaceNewLine: false, strikethrough: false, // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 fencedChars: null // TUI.EDITOR MODIFICATION END @@ -798,7 +798,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { f: s.f, // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 prevLine: s.prevLine, thisLine: s.this, @@ -818,7 +818,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { formatting: false, linkTitle: s.linkTitle, // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 code: s.code, // TUI.EDITOR MODIFICATION END @@ -841,7 +841,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { trailingSpaceNewLine: s.trailingSpaceNewLine, md_inside: s.md_inside, // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 fencedChars: s.fencedChars // TUI.EDITOR MODIFICATION END @@ -854,7 +854,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { state.formatting = false; // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 if (stream != state.thisLine) { var forceBlankLine = state.header || state.hr; @@ -868,7 +868,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { if (stream.match(/^\s*$/, true) || forceBlankLine) { // TUI.EDITOR MODIFICATION START -// scrollFollow prototype +// scrollSync prototype // https://github.nhnent.com/fe/tui.editor/commit/f63d6ae79078923d369e6c170d07485f05c42fd7 blankLine(state); if (!forceBlankLine) return null diff --git a/src/js/extensions/scrollFollow/scrollSync.js b/src/js/extensions/scrollSync/scrollManager.js similarity index 97% rename from src/js/extensions/scrollFollow/scrollSync.js rename to src/js/extensions/scrollSync/scrollManager.js index 950b13702b..3ca661f998 100644 --- a/src/js/extensions/scrollFollow/scrollSync.js +++ b/src/js/extensions/scrollSync/scrollManager.js @@ -1,5 +1,5 @@ /** - * @fileoverview Implements Scroll Follow Extension ScrollSync Module + * @fileoverview Implements Scroll Follow Extension ScrollManager Module * @author Sungho Kim(sungho-kim@nhnent.com) FE Development Team/NHN Ent. */ import util from 'tui-code-snippet'; @@ -9,16 +9,16 @@ const SCROLL_TOP_PADDING = 20; const SCROLL_BOCKING_RESET_DELAY = 15; /** - * Class ScrollSync + * Class ScrollManager * manage scroll sync between markdown editor and preview */ -class ScrollSync { +class ScrollManager { /** - * Creates an instance of ScrollSync. + * Creates an instance of ScrollManager. * @param {SectionManager} sectionManager - sectionManager * @param {CodeMirror} cm - CodeMirror * @param {jQuery} $previewContainerEl - preview container - * @memberof ScrollSync + * @memberof ScrollManager */ constructor(sectionManager, cm, $previewContainerEl) { this.sectionManager = sectionManager; @@ -327,7 +327,7 @@ class ScrollSync { /** * Save Codemirror's scrollInfo for alternative use - * memberOf ScrollSync + * memberOf ScrollManager */ saveScrollInfo() { this._savedScrollInfo = this.cm.getScrollInfo(); @@ -351,4 +351,4 @@ class ScrollSync { } } -export default ScrollSync; +export default ScrollManager; diff --git a/src/js/extensions/scrollFollow/scrollFollow.js b/src/js/extensions/scrollSync/scrollSync.js similarity index 76% rename from src/js/extensions/scrollFollow/scrollFollow.js rename to src/js/extensions/scrollSync/scrollSync.js index ebe37ff3e0..bb33780990 100644 --- a/src/js/extensions/scrollFollow/scrollFollow.js +++ b/src/js/extensions/scrollSync/scrollSync.js @@ -4,13 +4,13 @@ */ import $ from 'jquery'; import Editor from '../editor'; -import ScrollSync from './scrollSync'; +import ScrollManager from './scrollManager'; import SectionManager from './sectionManager'; const {Button} = Editor; -function scrollFollowExtension(editor) { - const className = 'tui-scrollfollow'; +function scrollSyncExtension(editor) { + const className = 'tui-scrollsync'; const i18n = editor.i18n; const TOOL_TIP = { active: i18n.get('Auto scroll enabled'), @@ -23,7 +23,7 @@ function scrollFollowExtension(editor) { const cm = editor.getCodeMirror(); const sectionManager = new SectionManager(cm, editor.preview); - const scrollSync = new ScrollSync(sectionManager, cm, editor.preview.$el); + const scrollManager = new ScrollManager(sectionManager, cm, editor.preview.$el); let isScrollable = false; let isActive = true; @@ -35,7 +35,7 @@ function scrollFollowExtension(editor) { // init button button = new Button({ className, - command: 'scrollFollowToggle', + command: 'scrollSyncToggle', tooltip: TOOL_TIP.active, $el: $(``) }); @@ -50,7 +50,7 @@ function scrollFollowExtension(editor) { // Commands editor.addCommand('markdown', { - name: 'scrollFollowToggle', + name: 'scrollSyncToggle', exec() { isActive = !isActive; button._onOut(); @@ -87,7 +87,7 @@ function scrollFollowExtension(editor) { editor.on('previewRenderAfter', () => { sectionManager.sectionMatch(); - scrollSync.syncPreviewScrollTopToMarkdown(); + scrollManager.syncPreviewScrollTopToMarkdown(); isScrollable = true; }); @@ -97,17 +97,17 @@ function scrollFollowExtension(editor) { } if (isScrollable && editor.preview.isVisible()) { - if (event.source === 'markdown' && !scrollSync.isMarkdownScrollEventBlocked) { - scrollSync.syncPreviewScrollTopToMarkdown(); - } else if (event.source === 'preview' && !scrollSync.isPreviewScrollEventBlocked) { - scrollSync.syncMarkdownScrollTopToPreview(); + if (event.source === 'markdown' && !scrollManager.isMarkdownScrollEventBlocked) { + scrollManager.syncPreviewScrollTopToMarkdown(); + } else if (event.source === 'preview' && !scrollManager.isPreviewScrollEventBlocked) { + scrollManager.syncMarkdownScrollTopToPreview(); } } else { - scrollSync.saveScrollInfo(); + scrollManager.saveScrollInfo(); } }); } -Editor.defineExtension('scrollFollow', scrollFollowExtension); +Editor.defineExtension('scrollSync', scrollSyncExtension); -export default scrollFollowExtension; +export default scrollSyncExtension; diff --git a/src/js/extensions/scrollFollow/sectionManager.js b/src/js/extensions/scrollSync/sectionManager.js similarity index 100% rename from src/js/extensions/scrollFollow/sectionManager.js rename to src/js/extensions/scrollSync/sectionManager.js diff --git a/src/js/indexAll.js b/src/js/indexAll.js index 99604ee66a..125392b87e 100644 --- a/src/js/indexAll.js +++ b/src/js/indexAll.js @@ -2,7 +2,7 @@ const Editor = require('./index'); import './extensions/chart/chart'; import './extensions/mark/mark'; -import './extensions/scrollFollow/scrollFollow'; +import './extensions/scrollSync/scrollSync'; import './extensions/table/table'; import './extensions/colorSyntax'; import './extensions/taskCounter'; diff --git a/test/extensions/scrollFollow/scrollSync.spec.js b/test/extensions/scrollSync/scrollManager.spec.js similarity index 78% rename from test/extensions/scrollFollow/scrollSync.spec.js rename to test/extensions/scrollSync/scrollManager.spec.js index 22db7b5986..155c665c31 100644 --- a/test/extensions/scrollFollow/scrollSync.spec.js +++ b/test/extensions/scrollSync/scrollManager.spec.js @@ -1,10 +1,10 @@ import TuiEditor from '../../../src/js/editor'; -import ScrollSync from '../../../src/js/extensions/scrollFollow/scrollSync'; -import SectionManager from '../../../src/js/extensions/scrollFollow/sectionManager'; +import ScrollManager from '../../../src/js/extensions/scrollSync/scrollManager'; +import SectionManager from '../../../src/js/extensions/scrollSync/sectionManager'; -describe('ScrollSync', () => { - let ned, sectionManager, scrollSync, container; +describe('ScrollManager', () => { + let ned, sectionManager, scrollManager, container; beforeEach(() => { jasmine.getStyleFixtures().fixturesPath = '/base'; @@ -24,7 +24,7 @@ describe('ScrollSync', () => { events: { 'load': function(editor) { sectionManager = new SectionManager(editor.getCodeMirror(), editor.preview); - scrollSync = new ScrollSync(sectionManager, editor.getCodeMirror(), editor.preview.$el); + scrollManager = new ScrollManager(sectionManager, editor.getCodeMirror(), editor.preview.$el); } } }); @@ -63,7 +63,7 @@ describe('ScrollSync', () => { const cm = ned.getCodeMirror(); cm.scrollTo(0, Math.ceil(cm.heightAtLine(1, 'local'))); - const scrollFactors = scrollSync._getScrollFactorsOfEditor(); + const scrollFactors = scrollManager._getScrollFactorsOfEditor(); expect(scrollFactors.section.end).toEqual(4); expect(scrollFactors.sectionRatio).not.toEqual(0); @@ -73,7 +73,7 @@ describe('ScrollSync', () => { const cm = ned.getCodeMirror(); cm.scrollTo(0, cm.heightAtLine(12, 'local')); - const scrollFactors = scrollSync._getScrollFactorsOfEditor(); + const scrollFactors = scrollManager._getScrollFactorsOfEditor(); expect(scrollFactors.isEditorBottom).toBe(true); }); @@ -82,7 +82,7 @@ describe('ScrollSync', () => { describe('running animation', () => { it('call step callback function', () => { const stepCallback = jasmine.createSpy('stepCallback'); - scrollSync._animateRun(0, 10, stepCallback); + scrollManager._animateRun(0, 10, stepCallback); expect(stepCallback).toHaveBeenCalled(); }); @@ -90,7 +90,7 @@ describe('ScrollSync', () => { it('value', done => { const values = []; - scrollSync._animateRun(0, 100, value => { + scrollManager._animateRun(0, 100, value => { values.push(value); if (value === 100) { @@ -116,15 +116,15 @@ describe('ScrollSync', () => { sectionManager.makeSectionList(); - const previewScrollTop = scrollSync.$previewContainerEl.scrollTop(); + const previewScrollTop = scrollManager.$previewContainerEl.scrollTop(); ned.on('previewRenderAfter', () => { sectionManager.sectionMatch(); cm.scrollTo(0, cm.heightAtLine(3, 'local')); - scrollSync.syncPreviewScrollTopToMarkdown(); + scrollManager.syncPreviewScrollTopToMarkdown(); - expect(scrollSync.$previewContainerEl.scrollTop()).not.toEqual(previewScrollTop); + expect(scrollManager.$previewContainerEl.scrollTop()).not.toEqual(previewScrollTop); done(); }); @@ -144,7 +144,7 @@ describe('ScrollSync', () => { sectionManager.makeSectionList(); - const previewScrollTop = scrollSync.$previewContainerEl.scrollTop(); + const previewScrollTop = scrollManager.$previewContainerEl.scrollTop(); ned.on('previewRenderAfter', () => { sectionManager.sectionMatch(); @@ -155,9 +155,9 @@ describe('ScrollSync', () => { cm.scrollTo(0, cm.heightAtLine(1, 'local')); - scrollSync.syncPreviewScrollTopToMarkdown(); + scrollManager.syncPreviewScrollTopToMarkdown(); - expect(scrollSync.$previewContainerEl.scrollTop()).toEqual(previewScrollTop); + expect(scrollManager.$previewContainerEl.scrollTop()).toEqual(previewScrollTop); done(); }); @@ -179,7 +179,7 @@ describe('ScrollSync', () => { sectionManager.makeSectionList(); - scrollSync.saveScrollInfo(); + scrollManager.saveScrollInfo(); cm.scrollTo(0, cm.heightAtLine(6, 'local')); @@ -187,7 +187,7 @@ describe('ScrollSync', () => { const scrollInfo = cm.getScrollInfo(); - expect(scrollSync._fallbackScrollInfoIfIncorrect(scrollInfo)).toBe(scrollSync._savedScrollInfo); + expect(scrollManager._fallbackScrollInfoIfIncorrect(scrollInfo)).toBe(scrollManager._savedScrollInfo); }); }); }); diff --git a/test/extensions/scrollFollow/scrollFollow.spec.js b/test/extensions/scrollSync/scrollSync.spec.js similarity index 86% rename from test/extensions/scrollFollow/scrollFollow.spec.js rename to test/extensions/scrollSync/scrollSync.spec.js index 45ac051467..13b60dfbcd 100644 --- a/test/extensions/scrollFollow/scrollFollow.spec.js +++ b/test/extensions/scrollSync/scrollSync.spec.js @@ -1,9 +1,9 @@ import $ from 'jquery'; import TuiEditor from '../../../src/js/editor'; -import '../../../src/js/extensions/scrollFollow/scrollFollow'; +import '../../../src/js/extensions/scrollSync/scrollSync'; -describe('scrollFollow', () => { +describe('scrollSync', () => { let ned, container; beforeEach(() => { @@ -17,7 +17,7 @@ describe('scrollFollow', () => { previewStyle: 'vertical', height: '100px', initialEditType: 'markdown', - exts: ['scrollFollow'], + exts: ['scrollSync'], events: { 'load': editor => { editor.getCodeMirror().setSize(200, 50); @@ -48,8 +48,8 @@ describe('scrollFollow', () => { ].join('\n')); }); - it('disable scrollFollow', () => { - ned.exec('scrollFollow.diasable'); + it('disable scrollSync', () => { + ned.exec('scrollSync.diasable'); }); }); }); diff --git a/test/extensions/scrollFollow/sectionManager.spec.js b/test/extensions/scrollSync/sectionManager.spec.js similarity index 98% rename from test/extensions/scrollFollow/sectionManager.spec.js rename to test/extensions/scrollSync/sectionManager.spec.js index 3e299c9e16..3da53da412 100644 --- a/test/extensions/scrollFollow/sectionManager.spec.js +++ b/test/extensions/scrollSync/sectionManager.spec.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import TuiEditor from '../../../src/js/editor'; -import SectionManager from '../../../src/js/extensions/scrollFollow/sectionManager'; +import SectionManager from '../../../src/js/extensions/scrollSync/sectionManager'; describe('sectionManager', () => { let ned, sectionManager, container; @@ -197,7 +197,7 @@ describe('sectionManager', () => { expect(sectionManager.getSectionList().length).toBe(2); }); - it('dont make section with line followed by table', () => { + it('dont make section with line synced by table', () => { ned.setValue([ 'paragraph', 'header1', @@ -247,7 +247,7 @@ describe('sectionManager', () => { expect(sectionManager.getSectionList().length).toBe(2); }); - it('dont make section with line followed by codeBlock', () => { + it('dont make section with line synced by codeBlock', () => { ned.setValue([ 'paragraph', 'header1', diff --git a/test/integration/editor.spec.js b/test/integration/editor.spec.js index 80033bcb09..b832c213ee 100644 --- a/test/integration/editor.spec.js +++ b/test/integration/editor.spec.js @@ -32,7 +32,7 @@ describe('Editor', () => { document.body.style.paddingTop = '0px'; }); - it('should not throw exception on initializing with long content in case of markdown type vertical scrollFollow enabled', done => { + it('should not throw exception on initializing with long content in case of markdown type vertical scrollSync enabled', done => { // the exception will be thrown from async, we can't no.toThrow() here // just wait and see if uncaught exception has been thrown or not const editor = new Editor({ // eslint-disable-line @@ -41,7 +41,7 @@ describe('Editor', () => { initialValue: 'a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n', initialEditType: 'markdown', previewStyle: 'vertical', - exts: ['scrollFollow'] + exts: ['scrollSync'] }); setTimeout(done, 1000); diff --git a/webpack.config.js b/webpack.config.js index c5fcce3b8b..16ef5887c3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,7 +14,7 @@ const ENTRY_VIEWER_ALL = './src/js/indexViewerAll.js'; const ENTRY_EXT_CHART = './src/js/extensions/chart/chart.js'; const ENTRY_EXT_UML = './src/js/extensions/uml.js'; const ENTRY_EXT_COLOR_SYNTAX = './src/js/extensions/colorSyntax.js'; -const ENTRY_EXT_SCROLL_FOLLOW = './src/js/extensions/scrollFollow/scrollFollow.js'; +const ENTRY_EXT_SCROLL_SYNC = './src/js/extensions/scrollSync/scrollSync.js'; const ENTRY_EXT_TASK_COUNTER = './src/js/extensions/taskCounter.js'; const ENTRY_EXT_MARK = './src/js/extensions/mark/mark.js'; const ENTRY_EXT_TABLE = './src/js/extensions/table/table.js'; @@ -172,7 +172,7 @@ if (isDevServer) { 'extChart': ENTRY_EXT_CHART, 'extUML': ENTRY_EXT_UML, 'extColorSyntax': ENTRY_EXT_COLOR_SYNTAX, - 'extScrollFollow': ENTRY_EXT_SCROLL_FOLLOW, + 'extScrollSync': ENTRY_EXT_SCROLL_SYNC, 'extTaskCounter': ENTRY_EXT_TASK_COUNTER, 'extMark': ENTRY_EXT_MARK, 'extTable': ENTRY_EXT_TABLE