Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit 958debf

Browse files
Bhargav KrishnaWrathOfZombies
Bhargav Krishna
authored andcommittedFeb 24, 2018
Adding HTML transformation
1 parent 551a94e commit 958debf

File tree

5 files changed

+52
-39
lines changed

5 files changed

+52
-39
lines changed
 

‎global.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.html" {
2+
const content: string;
3+
export default content;
4+
}

‎src/ui/message-banner.html

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div class="office-js-helpers-notification ms-font-m ms-MessageBar @@CLASS">
2+
<style>
3+
.office-js-helpers-notification {
4+
position: fixed;
5+
z-index: 2147483647;
6+
top: 0;
7+
left: 0;
8+
right: 0;
9+
width: 100%;
10+
padding: 0 0 10px 0;
11+
}
12+
13+
.office-js-helpers-notification > div > div {
14+
padding: 10px 15px;
15+
box-sizing: border-box;
16+
}
17+
18+
.office-js-helpers-notification pre {
19+
white-space: pre-wrap;
20+
word-wrap: break-word;
21+
margin: 0px;
22+
font-size: smaller;
23+
}
24+
25+
.office-js-helpers-notification > button {
26+
height: 52px;
27+
width: 40px;
28+
cursor: pointer;
29+
float: right;
30+
background: transparent;
31+
border: 0;
32+
margin-left: 10px;
33+
margin-right: '@@PADDING'
34+
}
35+
</style>
36+
<button>
37+
<i class="ms-Icon ms-Icon--Clear"></i>
38+
</button>
39+
</div>

‎src/ui/ui.ts

+2-37
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { isString, isError, isObject } from 'lodash-es';
44
import { CustomError } from '../errors/custom.error';
55
import { Utilities, PlatformType } from '../helpers/utilities';
6+
import html from './message-banner.html';
67

78
export class UI {
89
/** Shows a basic notification at the top of the page
@@ -67,43 +68,7 @@ export class UI {
6768
paddingForPersonalityMenu = '40px';
6869
}
6970

70-
const messageBannerHtml = `
71-
<div class="office-js-helpers-notification ms-font-m ms-MessageBar ${messageBarTypeClass}">
72-
<style>
73-
.office-js-helpers-notification {
74-
position: fixed;
75-
z-index: 2147483647;
76-
top: 0;
77-
left: 0;
78-
right: 0;
79-
width: 100%;
80-
padding: 0 0 10px 0;
81-
}
82-
.office-js-helpers-notification > div > div {
83-
padding: 10px 15px;
84-
box-sizing: border-box;
85-
}
86-
.office-js-helpers-notification pre {
87-
white-space: pre-wrap;
88-
word-wrap: break-word;
89-
margin: 0px;
90-
font-size: smaller;
91-
}
92-
.office-js-helpers-notification > button {
93-
height: 52px;
94-
width: 40px;
95-
cursor: pointer;
96-
float: right;
97-
background: transparent;
98-
border: 0;
99-
margin-left: 10px;
100-
margin-right: ${paddingForPersonalityMenu}
101-
}
102-
</style>
103-
<button>
104-
<i class="ms-Icon ms-Icon--Clear"></i>
105-
</button>
106-
</div>`;
71+
const messageBannerHtml = html.replace('@@CLASS', messageBarTypeClass).replace('\'@@PADDING\'', paddingForPersonalityMenu);
10772

10873
const existingNotifications = document.getElementsByClassName('office-js-helpers-notification');
10974
while (existingNotifications[0]) {

‎tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"moduleResolution": "node",
99
"emitDecoratorMetadata": true,
1010
"experimentalDecorators": true,
11+
"noResolve": false,
1112
"removeComments": false,
1213
"allowUnusedLabels": false,
1314
"noImplicitReturns": true,
@@ -16,12 +17,14 @@
1617
"sourceMap": true,
1718
"declaration": true,
1819
"allowSyntheticDefaultImports": true,
20+
"jsx": "react",
1921
"lib": [
2022
"dom",
2123
"es2016"
2224
],
2325
"typeRoots": [
24-
"node_modules/@types"
26+
"node_modules/@types",
27+
"./global.d.ts"
2528
]
2629
},
2730
"exclude": [

‎webpack.config.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ const config = {
3030
{
3131
test: /(\.html)$/,
3232
loader: 'html-loader',
33-
exclude: /node_modules/
33+
options: {
34+
exportAsEs6Default: true
35+
}
3436
},
3537
{
3638
test: /(\.ts)$/,

0 commit comments

Comments
 (0)
This repository has been archived.