Skip to content

Commit

Permalink
fix svg import (#4160)
Browse files Browse the repository at this point in the history
* test svg import

* move config to globals.d.ts
  • Loading branch information
petrjasek authored Dec 14, 2022
1 parent 65dcca5 commit a036b99
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions scripts/apps/dashboard/controllers/DashboardController.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import _ from 'lodash';
import {gettext} from 'core/utils';

import emptyState from 'superdesk-ui-framework/dist/empty-state--large-dashboard.svg';

DashboardController.$inject = [
'$scope',
'desks',
Expand Down Expand Up @@ -29,12 +31,12 @@ export function DashboardController(

$scope.edited = null;
$scope.workspaces = workspaces;
$scope.emptyState = emptyState;

$scope.$watch('workspaces.active', setupWorkspace);
workspaces.getActive();
pageTitle.setUrl(gettext('Dashboard'));

$scope.emptyState = require('node_modules/superdesk-ui-framework/dist/empty-state--large-dashboard.svg');

function setupWorkspace(workspace) {
self.current = null;
if (workspace) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/core/menu/notifications/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {AuthoringWorkspaceService} from 'apps/authoring/authoring/services/Autho
import {extensions} from 'appConfig';
import {IExtensionActivationResult} from 'superdesk-api';
import {logger} from 'core/services/logger';
import emptyState from 'superdesk-ui-framework/dist/empty-state--small-2.svg';

UserNotificationsService.$inject = [
'$rootScope',
Expand Down Expand Up @@ -292,7 +293,7 @@ angular.module('superdesk.core.menu.notifications', ['superdesk.core.services.as
require: '^sdSuperdeskView',
templateUrl: asset.templateUrl('core/menu/notifications/views/notifications.html'),
link: function(scope, elem, attrs, ctrl) {
scope.emptyState = require('node_modules/superdesk-ui-framework/dist/empty-state--small-2.svg');
scope.emptyState = emptyState;

// merged from all extensions
const notificationsKeyed: IExtensionActivationResult['contributions']['notifications'] = {};
Expand Down
6 changes: 5 additions & 1 deletion scripts/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ interface Window {
iframely: any;
}

// Allow importing json/html files
// Allow importing json/html/svg files
declare module "*.json";
declare module "*.html";
declare module "*.svg" {
const content: string;
export default content;
}

// ------------------------------------------------------------------------------------------------
// TYPES
Expand Down

0 comments on commit a036b99

Please sign in to comment.