Skip to content

Commit

Permalink
Fixed node types being used instead of dom-globals
Browse files Browse the repository at this point in the history
  • Loading branch information
lnewson committed Mar 7, 2019
1 parent 33a817b commit 5f29bed
Show file tree
Hide file tree
Showing 78 changed files with 178 additions and 100 deletions.
2 changes: 1 addition & 1 deletion src/core/demo/ts/demo/AnnotationsDemo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { prompt, document } from '@ephox/dom-globals';
import { console, document, prompt } from '@ephox/dom-globals';
import { Editor } from 'tinymce/core/api/Editor';

declare let tinymce: any;
Expand Down
1 change: 1 addition & 0 deletions src/core/demo/ts/demo/ContentEditableFalseDemo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// tslint:disable:no-console
import { console } from '@ephox/dom-globals';
import { Editor } from 'tinymce/core/api/Editor';

declare const window: any;
Expand Down
1 change: 1 addition & 0 deletions src/core/demo/ts/demo/FullDemo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { console } from '@ephox/dom-globals';
import { Merger } from '@ephox/katamari';
import { Element } from '@ephox/sugar';

Expand Down
1 change: 1 addition & 0 deletions src/core/main/ts/api/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Tinymce from './Tinymce';

declare const module: any;
declare const window: any;

const exportToModuleLoaders = (tinymce) => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/main/ts/api/dom/ScriptLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { console, document } from '@ephox/dom-globals';
import DOMUtils from './DOMUtils';
import Tools from '../util/Tools';
import { document } from '@ephox/dom-globals';

/*globals console*/

Expand Down
2 changes: 1 addition & 1 deletion src/core/main/ts/api/util/Delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import Promise from './Promise';
import { window, document } from '@ephox/dom-globals';
import { clearInterval, clearTimeout, document, setInterval, setTimeout, window } from '@ephox/dom-globals';

/**
* Utility class for working with delayed actions like setTimeout.
Expand Down
2 changes: 2 additions & 0 deletions src/core/main/ts/api/util/Promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* Promise polyfill under MIT license: https://github.com/taylorhakes/promise-polyfill
*/

import { setImmediate, setTimeout } from '@ephox/dom-globals';

declare const window: any;

const promise = function () {
Expand Down
5 changes: 3 additions & 2 deletions src/core/main/ts/api/util/XHR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { XMLHttpRequest } from '@ephox/sand';
import Delay from './Delay';
import Observable from './Observable';
import Tools from './Tools';

Expand Down Expand Up @@ -50,7 +51,7 @@ const XHR: any = {

xhr = null;
} else {
setTimeout(ready, 10);
Delay.setTimeout(ready, 10);
}
};

Expand Down Expand Up @@ -97,7 +98,7 @@ const XHR: any = {
}

// Wait for response, onReadyStateChange can not be used since it leaks memory in IE
setTimeout(ready, 10);
Delay.setTimeout(ready, 10);
}
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/core/main/ts/caret/FakeCaret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { Element, Range, HTMLElement, ClientRect, Node } from '@ephox/dom-globals';
import { Cell, Option } from '@ephox/katamari';
import { PlatformDetection } from '@ephox/sand';
import * as CaretContainer from './CaretContainer';
import CaretContainerRemove from './CaretContainerRemove';
import DomQuery from '../api/dom/DomQuery';
import NodeType from '../dom/NodeType';
import * as GeomClientRect from '../geom/ClientRect';
import Delay from '../api/util/Delay';
import { Cell, Option } from '@ephox/katamari';
import { Element, Range, HTMLElement, ClientRect, Node } from '@ephox/dom-globals';
import { PlatformDetection } from '@ephox/sand';

export interface FakeCaret {
show: (before: boolean, element: Element) => Range;
Expand Down Expand Up @@ -162,7 +162,7 @@ export const FakeCaret = (root: HTMLElement, isBlock: (node: Node) => boolean, h
lastVisualCaret.set(Option.none());
});

clearInterval(cursorInterval);
Delay.clearInterval(cursorInterval);
};

const startBlink = () => {
Expand Down
13 changes: 6 additions & 7 deletions src/core/test/ts/browser/EditorUploadTest.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Pipeline, Step } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { document } from '@ephox/dom-globals';
import { Arr, Fun } from '@ephox/katamari';
import { LegacyUnit, TinyLoader } from '@ephox/mcagar';
import DOMUtils from 'tinymce/core/api/dom/DOMUtils';
import Env from 'tinymce/core/api/Env';
import Conversions from 'tinymce/core/file/Conversions';
import Theme from 'tinymce/themes/silver/Theme';
import { UnitTest } from '@ephox/bedrock';
import { document } from '@ephox/dom-globals';
import Delay from 'tinymce/core/api/util/Delay';

UnitTest.asynctest('browser.tinymce.core.EditorUploadTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
UnitTest.asynctest('browser.tinymce.core.EditorUploadTest', (success, failure) => {
const suite = LegacyUnit.createSuite();

Theme();
Expand Down Expand Up @@ -204,7 +203,7 @@ UnitTest.asynctest('browser.tinymce.core.EditorUploadTest', function () {
editor.settings.images_upload_handler = function (data, success) {
uploadCount++;

setTimeout(function () {
Delay.setTimeout(function () {
success('myimage.png');
}, 0);
};
Expand Down Expand Up @@ -234,7 +233,7 @@ UnitTest.asynctest('browser.tinymce.core.EditorUploadTest', function () {
editor.settings.images_upload_handler = function (data, success, failure) {
uploadCount++;

setTimeout(function () {
Delay.setTimeout(function () {
failure('Error');
}, 0);
};
Expand Down
7 changes: 4 additions & 3 deletions src/core/test/ts/browser/caret/LineReaderTest.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Assertions, Chain, GeneralSteps, Logger, Pipeline } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { console } from '@ephox/dom-globals';
import { Arr, Fun, Option } from '@ephox/katamari';
import { PlatformDetection } from '@ephox/sand';
import { Hierarchy, Element } from '@ephox/sugar';
import { CaretPosition } from 'tinymce/core/caret/CaretPosition';
import { getPositionsUntilPreviousLine, LineInfo, getPositionsUntilNextLine, getPositionsAbove, getPositionsBelow, isAtFirstLine, isAtLastLine, findClosestHorizontalPosition, BreakType } from 'tinymce/core/caret/LineReader';
import ViewBlock from '../../module/test/ViewBlock';
import { UnitTest } from '@ephox/bedrock';
import { Arr, Fun, Option } from '@ephox/katamari';
import { PlatformDetection } from '@ephox/sand';

UnitTest.asynctest('browser.tinymce.core.caret.LineReader', (success, failure) => {
const viewBlock = ViewBlock();
Expand Down
6 changes: 3 additions & 3 deletions src/core/test/ts/browser/init/EditorInitializationTest.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Assertions, GeneralSteps, Logger, Pipeline, Step, ApproxStructure } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { console, document, window } from '@ephox/dom-globals';
import { Arr } from '@ephox/katamari';
import { LegacyUnit } from '@ephox/mcagar';
import { Element, Attr, SelectorFilter } from '@ephox/sugar';
import EditorManager from 'tinymce/core/api/EditorManager';
import Env from 'tinymce/core/api/Env';
import ViewBlock from '../../module/test/ViewBlock';
import Tools from 'tinymce/core/api/util/Tools';
import Theme from 'tinymce/themes/silver/Theme';
import { UnitTest } from '@ephox/bedrock';
import { window, document } from '@ephox/dom-globals';
import ViewBlock from '../../module/test/ViewBlock';

UnitTest.asynctest('browser.tinymce.core.init.EditorInitializationTest', function (success, failure) {
const suite = LegacyUnit.createSuite();
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/autosave/main/ts/core/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { Cell } from '@ephox/katamari';
import { Editor } from 'tinymce/core/api/Editor';
import Delay from 'tinymce/core/api/util/Delay';
import LocalStorage from 'tinymce/core/api/util/LocalStorage';
import Tools from 'tinymce/core/api/util/Tools';
import * as Events from '../api/Events';
import * as Settings from '../api/Settings';
import { Editor } from 'tinymce/core/api/Editor';
import { Cell } from '@ephox/katamari';

const isEmpty = (editor: Editor, html?: string) => {
const forcedRootBlockName = editor.settings.forced_root_block;
Expand Down Expand Up @@ -67,7 +68,7 @@ const startStoreDraft = (editor: Editor, started: Cell<boolean>) => {
const interval = Settings.getAutoSaveInterval(editor);

if (!started.get()) {
setInterval(() => {
Delay.setInterval(() => {
if (!editor.removed) {
storeDraft(editor);
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/colorpicker/main/ts/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { console } from '@ephox/dom-globals';
import PluginManager from 'tinymce/core/api/PluginManager';

PluginManager.add('colorpicker', function () {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/contextmenu/main/ts/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { console } from '@ephox/dom-globals';
import PluginManager from 'tinymce/core/api/PluginManager';

PluginManager.add('contextmenu', function () {
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/emoticons/main/ts/core/EmojiDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { console } from '@ephox/dom-globals';
import { Cell, Global, Obj, Option, Result, Merger } from '@ephox/katamari';
import ScriptLoader from 'tinymce/core/api/dom/ScriptLoader';
import Promise from 'tinymce/core/api/util/Promise';
import { Editor } from 'tinymce/core/api/Editor';
import Delay from 'tinymce/core/api/util/Delay';
import Settings from 'tinymce/plugins/emoticons/api/Settings';

const ALL_CATEGORY = 'All';
Expand Down Expand Up @@ -135,15 +137,15 @@ const initDatabase = (editor: Editor, databaseUrl: string): EmojiDatabase => {
} else {
return new Promise((resolve, reject) => {
let numRetries = 3;
const interval = setInterval(() => {
const interval = Delay.setInterval(() => {
if (hasLoaded()) {
clearInterval(interval);
Delay.clearInterval(interval);
resolve(true);
} else {
numRetries--;
if (numRetries < 0) {
console.log('Could not load emojis from url: ' + databaseUrl);
clearInterval(interval);
Delay.clearInterval(interval);
reject(false);
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/image/demo/ts/demo/Demo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { console } from '@ephox/dom-globals';
import Delay from 'tinymce/core/api/util/Delay';

declare let tinymce: any;

tinymce.init({
Expand All @@ -21,7 +24,7 @@ tinymce.init({
},
images_upload_handler: (blobInfo, success, failure, progress) => {
console.log(blobInfo);
setTimeout(function () {
Delay.setTimeout(function () {
success('https://www.google.com/logos/google.jpg');
}, 5000);
},
Expand Down
1 change: 1 addition & 0 deletions src/plugins/image/test/ts/browser/ImageResizeTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Chain, Guard, Log, Mouse, Pipeline, UiFinder } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { console } from '@ephox/dom-globals';
import { TinyLoader, TinyUi } from '@ephox/mcagar';
import ImagePlugin from 'tinymce/plugins/image/Plugin';
import SilverTheme from 'tinymce/themes/silver/Theme';
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/imagetools/demo/ts/demo/Demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// tslint:disable:no-console

import { console } from '@ephox/dom-globals';
import Delay from 'tinymce/core/api/util/Delay';
import DomQuery from 'tinymce/core/api/dom/DomQuery';

declare let tinymce: any;
Expand Down Expand Up @@ -46,7 +48,7 @@ tinymce.init({
console.log('blob upload [started]', 'id:', data.id(), 'filename:', data.filename());
progress(0);

setTimeout(function () {
Delay.setTimeout(function () {
console.log('blob upload [ended]', data.id());
success(data.id() + '.png');
progress(100);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/imagetools/main/ts/core/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const startTimedUpload = function (editor: Editor, imageUploadTimerState) {
};

const cancelTimedUpload = function (imageUploadTimerState) {
clearTimeout(imageUploadTimerState.get());
Delay.clearTimeout(imageUploadTimerState.get());
};

const updateSelectedImage = function (editor: Editor, ir, uploadImmediately, imageUploadTimerState, selectedImage, size?) {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/imagetools/test/ts/browser/SequenceTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Pipeline, Log } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { console } from '@ephox/dom-globals';
import { TinyApis, TinyLoader } from '@ephox/mcagar';

import Plugin from 'tinymce/plugins/imagetools/Plugin';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GeneralSteps, Log, Pipeline, Step, Keys, Keyboard, Assertions } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { document } from '@ephox/dom-globals';
import { console, document } from '@ephox/dom-globals';
import { Arr } from '@ephox/katamari';
import { TinyLoader, TinyUi } from '@ephox/mcagar';
import { Element } from '@ephox/sugar';
Expand Down
1 change: 1 addition & 0 deletions src/plugins/link/main/ts/ui/DialogConfirms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For commercial licenses see https://www.tiny.cloud/
*/

import { console } from '@ephox/dom-globals';
import { Future, Option, Options } from '@ephox/katamari';
import Delay from 'tinymce/core/api/util/Delay';
import { Editor } from 'tinymce/core/api/Editor';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/link/test/ts/browser/DialogSectionsTest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../../../../../themes/silver/main/ts/Theme';
import 'tinymce/themes/silver/Theme';

import { GeneralSteps, Pipeline, UiFinder, Log } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { document } from '@ephox/dom-globals';
import { console, document } from '@ephox/dom-globals';
import { Arr, Option } from '@ephox/katamari';
import { TinyApis, TinyDom, TinyLoader } from '@ephox/mcagar';
import LinkPlugin from 'tinymce/plugins/link/Plugin';
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/media/test/ts/browser/IframeNodeTest.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Pipeline, UiFinder, Chain, Assertions, ApproxStructure, Log } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { TinyApis, TinyLoader } from '@ephox/mcagar';
import { Element } from '@ephox/sugar';

import Delay from 'tinymce/core/api/util/Delay';
import Plugin from 'tinymce/plugins/media/Plugin';
import Theme from 'tinymce/themes/silver/Theme';
import { Element } from '@ephox/sugar';

UnitTest.asynctest('browser.core.IframeNodeTest', function (success, failure) {
Plugin();
Expand Down Expand Up @@ -90,7 +91,7 @@ UnitTest.asynctest('browser.core.IframeNodeTest', function (success, failure) {
toolbar: 'media',
theme: 'silver',
media_url_resolver (data, resolve) {
setTimeout(function () {
Delay.setTimeout(function () {
resolve({
html: '<span id="fake">' + data.url + '</span>'
});
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/media/test/ts/browser/SubmitTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { GeneralSteps, Pipeline, Logger, Log } from '@ephox/agar';
import { UnitTest } from '@ephox/bedrock';
import { TinyApis, TinyLoader, TinyUi } from '@ephox/mcagar';

import Delay from 'tinymce/core/api/util/Delay';
import Plugin from 'tinymce/plugins/media/Plugin';
import Theme from 'tinymce/themes/silver/Theme';

Expand Down Expand Up @@ -41,7 +42,7 @@ UnitTest.asynctest('browser.core.SubmitTest', function (success, failure) {
toolbar: 'media',
theme: 'silver',
media_url_resolver (data, resolve) {
setTimeout(function () {
Delay.setTimeout(function () {
resolve({
html: '<span id="fake">' + data.url + '</span>'
});
Expand Down
1 change: 1 addition & 0 deletions src/plugins/paste/demo/ts/demo/Demo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// tslint:disable:no-console
import { console } from '@ephox/dom-globals';

declare let tinymce: any;

Expand Down
Loading

0 comments on commit 5f29bed

Please sign in to comment.