diff --git a/CHANGELOG.md b/CHANGELOG.md index 3358a521e..8630c9242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - `ParallelCorpusListing` - `regescape` - `unregescape` + - `safeApply` - Renamed localization functions (just like the template filters): - `getLocaleString` to `loc` - `getLocaleStringObject` to `locObj` diff --git a/app/scripts/components/sidebar.js b/app/scripts/components/sidebar.js index b7115f735..98c99ba47 100644 --- a/app/scripts/components/sidebar.js +++ b/app/scripts/components/sidebar.js @@ -5,7 +5,7 @@ import "../../styles/sidebar.scss" import statemachine from "../statemachine" import settings from "@/settings" import { stringify } from "@/stringify.js" -import { html, loc, regescape, splitLemgram, locAttribute } from "@/util" +import { html, loc, regescape, splitLemgram, locAttribute, safeApply } from "@/util" import "@/components/deptree/deptree" let sidebarComponents = {} diff --git a/app/scripts/newsdesk.js b/app/scripts/newsdesk.js index 84bd66a12..ad8284801 100644 --- a/app/scripts/newsdesk.js +++ b/app/scripts/newsdesk.js @@ -3,6 +3,7 @@ // Requirements: JQuery, JQuery.ui.position, trust filter, loc filter, Font Awesome import _ from "lodash" import settings from "@/settings" +import { safeApply } from "@/util" angular.module("newsdesk", []).directive("newsDesk", [ "$rootElement", diff --git a/app/scripts/util.js b/app/scripts/util.js index 8bb223676..b512bf9ab 100644 --- a/app/scripts/util.js +++ b/app/scripts/util.js @@ -24,7 +24,7 @@ export function angularLocationSearch(...args) { /** @deprecated */ window.locationSearch = angularLocationSearch -window.safeApply = function (scope, fn) { +export function safeApply(scope, fn) { if (scope.$$phase || scope.$root.$$phase) { return fn(scope) } else {