Updates desktopManager to handle extServer, bump dependencies, 3.0.22

This commit is contained in:
Mo Bitar 2019-11-21 16:01:11 -06:00
parent ec0555ad26
commit 7cbbf5ae1b
No known key found for this signature in database
GPG Key ID: C9EAD0759817F96F
6 changed files with 127 additions and 97 deletions

View File

@ -32,9 +32,9 @@ class DesktopManager {
this.majorDataChangeHandler && this.majorDataChangeHandler();
}
getApplicationDataPath() {
console.assert(this.applicationDataPath, "applicationDataPath is null");
return this.applicationDataPath;
getExtServerHost() {
console.assert(this.extServerHost, "extServerHost is null");
return this.extServerHost;
}
/*
@ -152,9 +152,9 @@ class DesktopManager {
}
/* Used to resolve "sn://" */
desktop_setApplicationDataPath(path) {
this.applicationDataPath = path;
this.$rootScope.$broadcast("desktop-did-set-application-path");
desktop_setExtServerHost(host) {
this.extServerHost = host;
this.$rootScope.$broadcast("desktop-did-set-ext-server-host");
}
desktop_setComponentInstallationSyncHandler(handler) {

View File

@ -18,7 +18,7 @@ class ThemeManager {
})
if(desktopManager.isDesktop) {
$rootScope.$on("desktop-did-set-application-path", () => {
$rootScope.$on("desktop-did-set-ext-server-host", () => {
this.activateCachedThemes();
})
} else {

View File

@ -13078,6 +13078,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SKAlert =
/*#__PURE__*/
function () {
@ -13085,12 +13087,24 @@ function () {
buttons: [{text, style, action}]
*/
function SKAlert(_ref) {
var _this = this;
var title = _ref.title,
text = _ref.text,
buttons = _ref.buttons;
_classCallCheck(this, SKAlert);
_defineProperty(this, "keyupListener", function (event) {
if (event.key === "Enter") {
var primaryButton = _this.primaryButton();
primaryButton.action && primaryButton.action();
_this.dismiss();
}
});
this.title = title;
this.text = text;
this.buttons = buttons;
@ -13118,9 +13132,30 @@ function () {
var template = "\n <div class=\"sk-modal\">\n <div class=\"sk-modal-background\"></div>\n <div class=\"sk-modal-content\">\n <div class=\"sn-component\">\n <div class=\"sk-panel\" style='max-width: 500px;'>\n <div class=\"sk-panel-content\">\n <div class=\"sk-panel-section\">\n ".concat(titleTemplate, "\n\n <div class=\"sk-panel-row\">\n ").concat(messageTemplate, "\n </div>\n\n <div class=\"sk-panel-row\" style='margin-top: 8px;'>\n ").concat(buttonsTemplate, "\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n ");
return template;
}
}, {
key: "dismiss",
value: function dismiss() {
this.onElement.removeChild(this.element);
document.removeEventListener("keyup", this.keyupListener);
}
}, {
key: "primaryButton",
value: function primaryButton() {
var primary = this.buttons.find(function (button) {
return button.primary === true;
});
if (!primary) {
primary = this.buttons[this.buttons.length - 1];
}
return primary;
}
}, {
key: "present",
value: function present() {
var _this2 = this;
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
onElement = _ref2.onElement;
@ -13128,21 +13163,21 @@ function () {
onElement = document.body;
}
var div = document.createElement('div');
div.innerHTML = this.templateString().trim();
var background = div.querySelector(".sk-modal-background");
background.addEventListener('click', function () {
onElement.removeChild(div);
});
this.onElement = onElement;
this.element = document.createElement('div');
this.element.className = 'sn-component';
this.element.innerHTML = this.templateString().trim();
document.addEventListener("keyup", this.keyupListener);
this.buttons.forEach(function (buttonDesc, index) {
var buttonElem = div.querySelector("#button-".concat(index));
var buttonElem = _this2.element.querySelector("#button-".concat(index));
buttonElem.onclick = function () {
buttonDesc.action && buttonDesc.action();
onElement.removeChild(div);
_this2.dismiss();
};
});
onElement.appendChild(div);
onElement.appendChild(this.element);
}
}]);
@ -13157,7 +13192,7 @@ function () {
/***/ })
/******/ ]);;/**
* @license AngularJS v1.7.8
* @license AngularJS v1.7.9
* (c) 2010-2018 Google, Inc. http://angularjs.org
* License: MIT
*/
@ -13257,7 +13292,7 @@ function isValidObjectMaxDepth(maxDepth) {
function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
var url = 'https://errors.angularjs.org/1.7.8/';
var url = 'https://errors.angularjs.org/1.7.9/';
var regex = url.replace('.', '\\.') + '[\\s\\S]*';
var errRegExp = new RegExp(regex, 'g');
@ -13639,8 +13674,10 @@ function baseExtend(dst, objs, deep) {
} else if (isElement(src)) {
dst[key] = src.clone();
} else {
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
baseExtend(dst[key], [src], true);
if (key !== '__proto__') {
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
baseExtend(dst[key], [src], true);
}
}
} else {
dst[key] = src;
@ -15963,11 +16000,11 @@ function toDebugString(obj, maxDepth) {
var version = {
// These placeholder strings will be replaced by grunt's `build` task.
// They need to be double- or single-quoted.
full: '1.7.8',
full: '1.7.9',
major: 1,
minor: 7,
dot: 8,
codeName: 'enthusiastic-oblation'
dot: 9,
codeName: 'pollution-eradication'
};
@ -16117,7 +16154,7 @@ function publishExternalAPI(angular) {
});
}
])
.info({ angularVersion: '1.7.8' });
.info({ angularVersion: '1.7.9' });
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@ -20618,7 +20655,7 @@ function $TemplateCacheProvider() {
*
* This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the
* actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large
* arrays or objects can have a negative impact on your application performance)
* arrays or objects can have a negative impact on your application performance.)
*
* <example name="doCheckArrayExample" module="do-check-module">
* <file name="index.html">
@ -20941,7 +20978,7 @@ function $TemplateCacheProvider() {
* would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
* case when only one deeply nested directive has `templateUrl`.
*
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}.
*
* You can specify `templateUrl` as a string representing the URL or as a function which takes two
* arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
@ -21002,7 +21039,7 @@ function $TemplateCacheProvider() {
* own templates or compile functions. Compiling these directives results in an infinite loop and
* stack overflow errors.
*
* This can be avoided by manually using $compile in the postLink function to imperatively compile
* This can be avoided by manually using `$compile` in the postLink function to imperatively compile
* a directive's template instead of relying on automatic template compilation via `template` or
* `templateUrl` declaration or manual compilation inside the compile function.
* </div>
@ -21106,17 +21143,17 @@ function $TemplateCacheProvider() {
*
* * `true` - transclude the content (i.e. the child nodes) of the directive's element.
* * `'element'` - transclude the whole of the directive's element including any directives on this
* element that defined at a lower priority than this directive. When used, the `template`
* element that are defined at a lower priority than this directive. When used, the `template`
* property is ignored.
* * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
*
* **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
* **Multi-slot transclusion** is declared by providing an object for the `transclude` property.
*
* This object is a map where the keys are the name of the slot to fill and the value is an element selector
* used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
* and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
*
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}.
*
* If the element selector is prefixed with a `?` then that slot is optional.
*
@ -21141,7 +21178,7 @@ function $TemplateCacheProvider() {
* </div>
*
* If you want to manually control the insertion and removal of the transcluded content in your directive
* then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
* then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery
* object that contains the compiled DOM, which is linked to the correct transclusion scope.
*
* When you call a transclusion function you can pass in a **clone attach function**. This function accepts
@ -21226,8 +21263,8 @@ function $TemplateCacheProvider() {
* The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
* `link()` or `compile()` functions. It has a variety of uses.
*
* * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
* 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
* * *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways:
* `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access
* to the attributes.
*
* * *Directive inter-communication:* All directives share the same instance of the attributes
@ -21268,25 +21305,24 @@ function $TemplateCacheProvider() {
<file name="index.html">
<script>
angular.module('compileExample', [], function($compileProvider) {
// configure new 'compile' directive by passing a directive
// factory function. The factory function injects the '$compile'
// Configure new 'compile' directive by passing a directive
// factory function. The factory function injects '$compile'.
$compileProvider.directive('compile', function($compile) {
// directive factory creates a link function
// The directive factory creates a link function.
return function(scope, element, attrs) {
scope.$watch(
function(scope) {
// watch the 'compile' expression for changes
// Watch the 'compile' expression for changes.
return scope.$eval(attrs.compile);
},
function(value) {
// when the 'compile' expression changes
// assign it into the current DOM
// When the 'compile' expression changes
// assign it into the current DOM.
element.html(value);
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
// Compile the new DOM and link it to the current scope.
// NOTE: we only compile '.childNodes' so that we
// don't get into an infinite loop compiling ourselves.
$compile(element.contents())(scope);
}
);
@ -21359,13 +21395,13 @@ function $TemplateCacheProvider() {
* }
* ```
* * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
* the cloned elements; only needed for transcludes that are allowed to contain non html
* elements (e.g. SVG elements). See also the directive.controller property.
* the cloned elements; only needed for transcludes that are allowed to contain non HTML
* elements (e.g. SVG elements). See also the `directive.controller` property.
*
* Calling the linking function returns the element of the template. It is either the original
* element passed in, or the clone of the element if the `cloneAttachFn` is provided.
*
* After linking the view is not updated until after a call to $digest which typically is done by
* After linking the view is not updated until after a call to `$digest`, which typically is done by
* AngularJS automatically.
*
* If you need access to the bound view, there are two ways to do it:
@ -21373,21 +21409,23 @@ function $TemplateCacheProvider() {
* - If you are not asking the linking function to clone the template, create the DOM element(s)
* before you send them to the compiler and keep this reference around.
* ```js
* var element = $compile('<p>{{total}}</p>')(scope);
* var element = angular.element('<p>{{total}}</p>');
* $compile(element)(scope);
* ```
*
* - if on the other hand, you need the element to be cloned, the view reference from the original
* example would not point to the clone, but rather to the original template that was cloned. In
* this case, you can access the clone via the cloneAttachFn:
* this case, you can access the clone either via the `cloneAttachFn` or the value returned by the
* linking function:
* ```js
* var templateElement = angular.element('<p>{{total}}</p>'),
* scope = ....;
*
* var templateElement = angular.element('<p>{{total}}</p>');
* var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
* //attach the clone to DOM document at the right place
* // Attach the clone to DOM document at the right place.
* });
*
* //now we have reference to the cloned DOM via `clonedElement`
* // Now we have reference to the cloned DOM via `clonedElement`.
* // NOTE: The `clonedElement` returned by the linking function is the same as the
* // `clonedElement` passed to `cloneAttachFn`.
* ```
*
*
@ -21913,9 +21951,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* @description
* Register a new directive with the compiler.
*
* @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
* will match as <code>ng-bind</code>), or an object map of directives where the keys are the
* names and the values are the factories.
* @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match
* as `ng-bind`), or an object map of directives where the keys are the names and the values
* are the factories.
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
* @returns {ng.$compileProvider} Self for chaining.
@ -47582,14 +47620,7 @@ var ngHideDirective = ['$animate', function($animate) {
var ngStyleDirective = ngDirective(function(scope, element, attr) {
scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
if (oldStyles && (newStyles !== oldStyles)) {
if (!newStyles) {
newStyles = {};
}
forEach(oldStyles, function(val, style) {
if (newStyles[style] == null) {
newStyles[style] = '';
}
});
forEach(oldStyles, function(val, style) { element.css(style, ''); });
}
if (newStyles) element.css(newStyles);
});
@ -51023,7 +51054,7 @@ var SNComponentManager = exports.SNComponentManager = function () {
console.log("Web|sendMessageToComponent", component, message);
}
var origin = this.urlForComponent(component, "file://");
var origin = this.urlForComponent(component);
if (!origin.startsWith("http") && !origin.startsWith("file")) {
// Native extension running in web, prefix current host
@ -51053,14 +51084,13 @@ var SNComponentManager = exports.SNComponentManager = function () {
}, {
key: "urlForComponent",
value: function urlForComponent(component) {
var offlinePrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; // offlineOnly is available only on desktop, and not on web or mobile.
// offlineOnly is available only on desktop, and not on web or mobile.
if (component.offlineOnly && !this.isDesktop) {
return null;
}
if (component.offlineOnly || this.isDesktop && component.local_url) {
return component.local_url && component.local_url.replace("sn://", offlinePrefix + this.desktopManager.getApplicationDataPath() + "/");
return component.local_url && component.local_url.replace("sn://", this.desktopManager.getExtServerHost());
} else {
var url = component.hosted_url || component.legacy_url;
@ -51804,7 +51834,7 @@ var SNComponentManager = exports.SNComponentManager = function () {
}, _callee2, this, [[7, 20, 24, 32], [25,, 27, 31]]);
}));
function handleSaveItemsMessage(_x3, _x4) {
function handleSaveItemsMessage(_x2, _x3) {
return _ref2.apply(this, arguments);
}
@ -52426,7 +52456,7 @@ var SNComponentManager = exports.SNComponentManager = function () {
}, _callee4, this);
}));
function registerComponentWindow(_x5, _x6) {
function registerComponentWindow(_x4, _x5) {
return _ref5.apply(this, arguments);
}
@ -52697,7 +52727,7 @@ var SNComponentManager = exports.SNComponentManager = function () {
}, _callee5, this, [[5, 9, 13, 21], [14,, 16, 20]]);
}));
function reloadComponent(_x9) {
function reloadComponent(_x8) {
return _ref6.apply(this, arguments);
}
@ -55590,7 +55620,7 @@ angular.module('app').directive("footer", ["authManager", function (authManager)
}, _callee7);
}));
return function (_x2) {
return function (_x6) {
return _ref7.apply(this, arguments);
};
}();
@ -57709,7 +57739,7 @@ function () {
}, _callee14, this);
}));
function executeAction(_x8, _x10, _x11, _x12) {
function executeAction(_x9, _x10, _x11, _x12) {
return _executeAction.apply(this, arguments);
}
@ -59069,10 +59099,10 @@ function () {
this.majorDataChangeHandler && this.majorDataChangeHandler();
}
}, {
key: "getApplicationDataPath",
value: function getApplicationDataPath() {
console.assert(this.applicationDataPath, "applicationDataPath is null");
return this.applicationDataPath;
key: "getExtServerHost",
value: function getExtServerHost() {
console.assert(this.extServerHost, "extServerHost is null");
return this.extServerHost;
}
/*
Sending a component in its raw state is really slow for the desktop app
@ -59351,10 +59381,10 @@ function () {
/* Used to resolve "sn://" */
}, {
key: "desktop_setApplicationDataPath",
value: function desktop_setApplicationDataPath(path) {
this.applicationDataPath = path;
this.$rootScope.$broadcast("desktop-did-set-application-path");
key: "desktop_setExtServerHost",
value: function desktop_setExtServerHost(host) {
this.extServerHost = host;
this.$rootScope.$broadcast("desktop-did-set-ext-server-host");
}
}, {
key: "desktop_setComponentInstallationSyncHandler",
@ -62205,7 +62235,7 @@ function () {
});
if (desktopManager.isDesktop) {
$rootScope.$on("desktop-did-set-application-path", function () {
$rootScope.$on("desktop-did-set-ext-server-host", function () {
_this92.activateCachedThemes();
});
} else {

File diff suppressed because one or more lines are too long

20
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "standard-notes-web",
"version": "3.0.21",
"version": "3.0.22",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1583,9 +1583,9 @@
"dev": true
},
"angular": {
"version": "1.7.8",
"resolved": "https://registry.npmjs.org/angular/-/angular-1.7.8.tgz",
"integrity": "sha512-wtef/y4COxM7ZVhddd7JtAAhyYObq9YXKar9tsW7558BImeVYteJiTxCKeJOL45lJ/+7B4wrAC49j8gTFYEthg==",
"version": "1.7.9",
"resolved": "https://registry.npmjs.org/angular/-/angular-1.7.9.tgz",
"integrity": "sha512-5se7ZpcOtu0MBFlzGv5dsM1quQDoDeUTwZrWjGtTNA7O88cD8TEk5IEKCTDa3uECV9XnvKREVUr7du1ACiWGFQ==",
"dev": true
},
"ansi-colors": {
@ -6241,9 +6241,9 @@
"dev": true
},
"sn-stylekit": {
"version": "2.0.17",
"resolved": "https://registry.npmjs.org/sn-stylekit/-/sn-stylekit-2.0.17.tgz",
"integrity": "sha512-TmLIgpI9TeQZhnxIEZ3ANKTPWwCBfmMiva9TNECB73jEJ2WNeAIkT7SyegPBauyCSP62Td8vxxo4UStUtj1PbQ==",
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/sn-stylekit/-/sn-stylekit-2.0.19.tgz",
"integrity": "sha512-3eanXKhuLB95S/mlBw15hHv7h993+BeURJAeEsZWs4oug00gE4TwAhv7iepMO2FcZ4vyfd8JH/wnj6P2Pem/Ow==",
"dev": true
},
"snapdragon": {
@ -6355,9 +6355,9 @@
}
},
"snjs": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/snjs/-/snjs-0.2.8.tgz",
"integrity": "sha512-qUPy+9DAQnF/MHnGt9lWndBpaC2EdSgZVf0HnRtMx5pRZ7vpcGeyuvyZwPGnRCwFJZcQDdidRp33/Xewy8wsww==",
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/snjs/-/snjs-0.2.9.tgz",
"integrity": "sha512-lJcwbHup3oRzwhcRmeu56WPyNT2R3s3CS8889hW3SfPIvDYK1526949exT69J+q0eIFe6J9orldeKFN8JEgIoQ==",
"dev": true
},
"source-map": {

View File

@ -1,6 +1,6 @@
{
"name": "standard-notes-web",
"version": "3.0.21",
"version": "3.0.22",
"license": "AGPL-3.0-or-later",
"repository": {
"type": "git",
@ -17,7 +17,7 @@
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/runtime": "^7.6.3",
"angular": "1.7.8",
"angular": "1.7.9",
"babel-plugin-angularjs-annotate": "^0.10.0",
"chai": "^4.2.0",
"connect": "^3.7.0",
@ -38,8 +38,8 @@
"grunt-shell": "^3.0.1",
"mocha": "^6.2.2",
"serve-static": "^1.14.1",
"sn-stylekit": "2.0.17",
"snjs": "0.2.8",
"sn-stylekit": "2.0.19",
"snjs": "0.2.9",
"standard-file-js": "0.3.71"
}
}