diff --git a/browser/Makefile.am b/browser/Makefile.am index 30c158407..2e8d663f6 100644 --- a/browser/Makefile.am +++ b/browser/Makefile.am @@ -193,6 +193,7 @@ COOL_LIBS_JS_DST = $(patsubst %.js,$(DIST_FOLDER)/%.js,$(COOL_LIBS_JS)) # this list includes both Javascript and Typescript generated files # in a rather precise order. COOL_JS_LST =\ + src/docstate.js \ src/Leaflet.js \ src/errormessages.js \ src/unocommands.js \ diff --git a/browser/js/global.js b/browser/js/global.js index 0acf8619b..672a8841d 100644 --- a/browser/js/global.js +++ b/browser/js/global.js @@ -1,50 +1,9 @@ /* -*- js-indent-level: 8 -*- */ /* global Uint8Array */ -window.app = { // Shouldn't have any functions defined. - definitions: {}, // Class instances are created using definitions under this variable. - dpiScale: window.devicePixelRatio, - roundedDpiScale: Math.round(window.devicePixelRatio), - twipsToPixels: 0, // Twips to pixels multiplier. - pixelsToTwips: 0, // Pixels to twips multiplier. - file: { - editComment: false, - readOnly: true, - disableSidebar: false, - size: { - pixels: [0, 0], // This can change according to the zoom level and document's size. - twips: [0, 0] - }, - viewedRectangle: [0, 0, 0, 0], // Visible part of the file (x, y, w, h). - fileBasedView: false, // (draw-impress only) Default is false. For read-only documents, user can view all parts at once. In that case, this variable is set to "true". - calc: { - cellCursor: { - address: [0, 0], - rectangle: { - pixels: [0, 0, 0, 0], - twips: [0, 0, 0, 0] - }, - visible: false, - } - }, - writer: { - pageRectangleList: [] // Array of arrays: [x, y, w, h] (as usual) // twips only. Pixels will be calculated on the fly. Corresponding pixels may change too ofte - }, - }, - view: { - commentHasFocus: false, - size: { - pixels: [0, 0] // This can be larger than the document's size. - } - }, - tile: { - size: { - pixels: [0, 0], - twips: [0, 0] - } - }, +window.app = { socket: null, - console: {}, + console: {} }; (function (global) { diff --git a/browser/src/docstate.js b/browser/src/docstate.js new file mode 100644 index 000000000..1575cadb9 --- /dev/null +++ b/browser/src/docstate.js @@ -0,0 +1,45 @@ +window.app = { // Shouldn't have any functions defined. + definitions: {}, // Class instances are created using definitions under this variable. + dpiScale: window.devicePixelRatio, + roundedDpiScale: Math.round(window.devicePixelRatio), + twipsToPixels: 0, // Twips to pixels multiplier. + pixelsToTwips: 0, // Pixels to twips multiplier. + file: { + editComment: false, + readOnly: true, + disableSidebar: false, + size: { + pixels: [0, 0], // This can change according to the zoom level and document's size. + twips: [0, 0] + }, + viewedRectangle: [0, 0, 0, 0], // Visible part of the file (x, y, w, h). + fileBasedView: false, // (draw-impress only) Default is false. For read-only documents, user can view all parts at once. In that case, this variable is set to "true". + calc: { + cellCursor: { + address: [0, 0], + rectangle: { + pixels: [0, 0, 0, 0], + twips: [0, 0, 0, 0] + }, + visible: false, + } + }, + writer: { + pageRectangleList: [] // Array of arrays: [x, y, w, h] (as usual) // twips only. Pixels will be calculated on the fly. Corresponding pixels may change too ofte + }, + }, + view: { + commentHasFocus: false, + size: { + pixels: [0, 0] // This can be larger than the document's size. + } + }, + tile: { + size: { + pixels: [0, 0], + twips: [0, 0] + } + }, + socket: window.app.socket, + console: window.app.console, +};