--------------------------------------------------------------------------------
/app/services/word-document/IReplacementCandidate.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
2 |
3 | /*
4 | This file creates a type that is used to record the location of a range
5 | relative to another range.
6 | */
7 |
8 | export interface IReplacementCandidate {
9 | range: Word.Range;
10 | locationRelation: OfficeExtension.ClientResult;
11 | }
--------------------------------------------------------------------------------
/app/main.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,kHAAkH;;AAElH;;EAEE;AAEF,8EAA2E;AAE3E,2CAAyC;AAEzC,SAAS,MAAM;IACX,IAAM,QAAQ,GAAG,iDAAsB,EAAE,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC;AACxC,CAAC;AAED,IAAI,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;IAEpE,wEAAwE;IACxE,oFAAoF;IACpF,yEAAyE;IACzE,MAAM,CAAC,UAAU,GAAG,UAAA,MAAM;QACxB,MAAM,EAAE,CAAC;IACX,CAAC,CAAA;CACF;KACI;IACH,MAAM,EAAE,CAAC;CACV"}
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "**/.git": true,
5 | "**/.DS_Store": true,
6 | "**/app/**/*.js": true,
7 | "**/*.map": true
8 | },
9 | // Controls auto save of dirty files. Accepted values: "off", "afterDelay", "onFocusChange". If set to "afterDelay" you can configure the delay in "files.autoSaveDelay".
10 | "files.autoSave": "afterDelay"
11 | }
--------------------------------------------------------------------------------
/app/shared/contextual-menu-button/contextual.menu.button.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/app/shared/navigation.header.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"navigation.header.component.js","sourceRoot":"","sources":["navigation.header.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBACgE,eAAe,CAAC,CAAA;AAEhF,iDAA8C,oCAAoC,CAAC,CAAA;AACnF,yDAAqD,6EAA6E,CAAC,CAAA;AAQnI;IAAA;IAGA,CAAC;IATD;QAAC,gBAAS,CAAC;YACP,QAAQ,EAAE,sBAAsB;YAChC,WAAW,EAAE,+DAA+D;YAC5E,SAAS,EAAE,CAAC,8DAA8D,CAAC;YAC3E,UAAU,EAAE,CAAC,gEAA6B,EAAE,+EAAoC,CAAC;SACpF,CAAC;;iCAAA;IAIF,gCAAC;AAAD,CAAC,AAHD,IAGC;AAHY,iCAAyB,4BAGrC,CAAA"}
--------------------------------------------------------------------------------
/app/app.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file defines the root component of the application.
5 | */
6 |
7 | import {Component} from '@angular/core';
8 |
9 | @Component({
10 | selector: 'sc-app',
11 | template: `
12 |
13 |
14 |
15 |
16 |
17 | `
18 | })
19 | export class AppComponent { }
--------------------------------------------------------------------------------
/app/shared/brand-footer/brand.footer.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/app/services/settings-storage/settings.storage.service.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"settings.storage.service.js","sourceRoot":"","sources":["settings.storage.service.ts"],"names":[],"mappings":";AAAA,kHAAkH;;;;;;;;;;;;AAElH;;EAEE;AAEF,sCAA2C;AAI3C;IAEI;IAAe,CAAC;IAEhB,sCAAK,GAAL,UAAM,WAAmB,EAAE,KAAa;QACpC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,sCAAK,GAAL,UAAM,WAAmB;QACrB,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IAED,uCAAM,GAAN,UAAO,WAAmB;QACtB,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAdQ,sBAAsB;QADlC,iBAAU,EAAE;;OACA,sBAAsB,CAelC;IAAD,6BAAC;CAAA,AAfD,IAeC;AAfY,wDAAsB"}
--------------------------------------------------------------------------------
/app/shared/button/button.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file defines a Fabic-styled button.
5 | */
6 |
7 | import { Component, Input } from '@angular/core';
8 |
9 | @Component({
10 | selector: 'sc-button',
11 | templateUrl: 'app/shared/button/button.component.html',
12 | styleUrls: ['app/shared/button/button.component.css']
13 | })
14 | export class ButtonComponent {
15 |
16 | // Text for the button label is provided by the parent view.
17 | @Input() buttonlabel: string;
18 | }
19 |
--------------------------------------------------------------------------------
/app/shared/office-fabric-component-wrappers/fabric.textfield.wrapper.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
12 |
14 |
--------------------------------------------------------------------------------
/app/shared/star.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"star.component.js","sourceRoot":"","sources":["star.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBACqC,eAAe,CAAC,CAAA;AAOrD;IAAA;QAKc,kBAAa,GACnB,IAAI,mBAAY,EAAU,CAAC;IAWnC,CAAC;IATG,mCAAW,GAAX;QACI,4BAA4B;QAC5B,yBAAyB;QACzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,+BAAO,GAAP;QACI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAc,IAAI,CAAC,MAAM,kBAAe,CAAC,CAAC;IACtE,CAAC;IAdD;QAAC,YAAK,EAAE;;qDAAA;IACR;QAAC,YAAK,EAAE;;iDAAA;IAER;QAAC,aAAM,EAAE;;wDAAA;IAVb;QAAC,gBAAS,CAAC;YACP,QAAQ,EAAE,SAAS;YACnB,WAAW,EAAE,gCAAgC;YAC7C,SAAS,EAAE,CAAC,+BAA+B,CAAC;SAC/C,CAAC;;qBAAA;IAkBF,oBAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,qBAAa,gBAiBzB,CAAA"}
--------------------------------------------------------------------------------
/Word-Add-in-Angular2-StyleChecker.yml:
--------------------------------------------------------------------------------
1 | ### YamlMime:Sample
2 | sample:
3 | - name: Word Style Checking Add-in Built on Angular 2.0
4 | path: ''
5 | description: Learn how to create an add-in that uses the LocationRelation and compareLocationWith APIs of the Word JavaScript APIs to perform a search and replace that skips some ranges based on their location relative to other ranges.
6 | readme: ''
7 | generateZip: FALSE
8 | isLive: TRUE
9 | technologies:
10 | - Office Add-in
11 | - Angular 2.0
12 | azureDeploy: ''
13 | author: rick-kirkham
14 | platforms: []
15 | languages:
16 | - JavaScript
17 | extensions:
18 | products:
19 | - Word
20 | scenarios: []
21 |
--------------------------------------------------------------------------------
/app/app.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo. */
2 |
3 | /* This file cancels out the browser's default styling, so the specific CSS files can start from a clean slate. */
4 |
5 | html, body {
6 | width: 100%;
7 | height: 100%;
8 | margin: 0;
9 | padding: 0;
10 | overflow: auto; }
11 |
12 | body {
13 | position: relative;
14 | font-size: 16px; }
15 |
16 | main {
17 | height: 100%;
18 | overflow-y: auto; }
19 |
20 | footer {
21 | width: 100%;
22 | position: relative;
23 | bottom: 0; }
24 |
25 | p, h1, h2, h3, h4, h5, h6 {
26 | margin: 0;
27 | padding: 0; }
28 |
29 | ul {
30 | padding: 0; }
31 |
--------------------------------------------------------------------------------
/app/shared/contextual-menu-button/contextual.menu.button.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"contextual.menu.button.component.js","sourceRoot":"","sources":["contextual.menu.button.component.ts"],"names":[],"mappings":";AAAA,kHAAkH;;;;;;;;;;;;AAElH;;EAEE;AAEF,sCAA8D;AAO9D;IAEI,uCAAoB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;IAAG,CAAC;IAE3C,sDAAc,GAAd;QACI,IAAI,WAAW,GAAgB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,qCAAqC;aACnD,WAAW,CAAG,uBAAuB;aACrC,WAAW,CAAG,yBAAyB;aACvC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAE,wCAAwC;QAClG,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAVQ,6BAA6B;QALzC,gBAAS,CAAC;YACP,QAAQ,EAAE,2BAA2B;YACrC,WAAW,EAAE,yEAAyE;YACtF,SAAS,EAAE,CAAC,wEAAwE,CAAC;SACxF,CAAC;yCAG+B,iBAAU;OAF9B,6BAA6B,CAWzC;IAAD,oCAAC;CAAA,AAXD,IAWC;AAXY,sEAA6B"}
--------------------------------------------------------------------------------
/app/app.module.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";AAAA,kHAAkH;;;;;;;;;AAElH;;;EAGE;AAEF,sCAA+C;AAC/C,8DAA2D;AAC3D,2DAA4D;AAE5D,oCAAoC;AACpC,iDAAuD;AACvD,4FAAwF;AACxF,0FAAuF;AACvF,oEAAkE;AAClE,qEAAmE;AACnE,sGAAkG;AAClG,uFAAmF;AACnF,qHAAiH;AACjH,+IAA0I;AAC1I,mIAA+H;AAE/H,0EAA0E;AAC1E,wFAAqF;AAErF,+EAA+E;AAC/E,iGAA8F;AA0B9F;IAAA;IAAyB,CAAC;IAAb,SAAS;QAvBrB,eAAQ,CAAC;YACR,OAAO,EAAE;gBACP,gCAAa;gBACb,qCAAgB;aACjB;YACD,YAAY,EAAE;gBACZ,4BAAY;gBACZ,oDAAuB;gBACvB,uDAAyB;gBACzB,sCAAiB;gBACjB,kCAAe;gBACf,uDAAyB;gBACzB,6CAAoB;gBACpB,gEAA6B;gBAC7B,+EAAoC;gBACpC,oEAA+B;aAChC;YACD,SAAS,EAAE;gBACT,2CAAmB;gBACnB,iDAAsB;aACrB;YACH,SAAS,EAAE,CAAE,4BAAY,CAAE;SAC5B,CAAC;OACW,SAAS,CAAI;IAAD,gBAAC;CAAA,AAA1B,IAA0B;AAAb,8BAAS"}
--------------------------------------------------------------------------------
/app/instructions/instruction-steps.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"instruction-steps.component.js","sourceRoot":"","sources":["instruction-steps.component.ts"],"names":[],"mappings":";AAAA,6HAA6H;;;;;;;;;;;;AAE7H;;;;;EAKE;AAEF,sCAA0C;AAC1C,0CAAyC;AASzC;IAWI,mCAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAT1B,UAAK,GAAW,SAAS,CAAC;QAC1B,sBAAiB,GAAW,8GAA8G,CAAC;QAC3I,gBAAW,GAAW,wBAAwB,CAAC;QAC/C,UAAK,GACb,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE;YAC3D,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,qDAAqD,EAAE;YAClF,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,mGAAmG,EAAE;YAChI,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAEb,CAAC;IAX9B,yBAAyB;QAJrC,gBAAS,CAAC;YACP,WAAW,EAAE,mDAAmD;YAChE,SAAS,EAAE,CAAC,kDAAkD,CAAC;SAClE,CAAC;yCAY8B,eAAM;OAXzB,yBAAyB,CAarC;IAAD,gCAAC;CAAA,AAbD,IAaC;AAbY,8DAAyB"}
--------------------------------------------------------------------------------
/app/instructions/instruction-step.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"instruction-step.component.js","sourceRoot":"","sources":["instruction-step.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAA0B,eAAe,CAAC,CAAA;AAC1C,uBAA0C,iBAAiB,CAAC,CAAA;AAE5D,iCAAgC,4BAA4B,CAAC,CAAA;AAQ7D;IAAA;QAEY,UAAK,GAAW,SAAS,CAAC;QAC1B,sBAAiB,GAAW,8GAA8G,CAAC;QAC3I,gBAAW,GAAW,wBAAwB,CAAA;QAC9C,UAAK,GACT,CAAC,EAAC,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,iCAAiC,EAAC;YAC5D,EAAC,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,qDAAqD,EAAC;YAChF,EAAC,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,mGAAmG,EAAC;YAC9H,EAAC,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAC,CAAC,CAAA;IAIrD,CAAC;IAlBD;QAAC,gBAAS,CAAC;YACP,WAAW,EAAE,mDAAmD;YAChE,UAAU,EAAE,CAAC,kCAAe,EAAE,0BAAiB,CAAC;YAChD,SAAS,EAAE,CAAC,kDAAkD,CAAC;SAClE,CAAC;;iCAAA;IAcF,gCAAC;AAAD,CAAC,AAbD,IAaC;AAbY,iCAAyB,4BAarC,CAAA"}
--------------------------------------------------------------------------------
/app/services/settings-storage/settings.storage.service.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file defines a service that provides CRUD operations on application settings.
5 | */
6 |
7 | import { Injectable } from '@angular/core';
8 |
9 |
10 | @Injectable()
11 | export class SettingsStorageService {
12 |
13 | constructor() {}
14 |
15 | store(specificKey: string, value: string) {
16 | window.localStorage.setItem(specificKey, value);
17 | }
18 |
19 | fetch(specificKey: string) : string {
20 | return window.localStorage.getItem(specificKey);
21 | }
22 |
23 | remove(specificKey: string) {
24 | window.localStorage.removeItem(specificKey);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/shared/brand-footer/brand.footer.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file defines a branded footer for a task pane page. It is based on
5 | the navigation sample, created by the Modern Assistance Experience Developer
6 | Docs team. Along with other samples, it is in the Office-Add-in-UX-Design-Patterns-Code
7 | repo: https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns-Code
8 | */
9 |
10 | import { Component} from '@angular/core';
11 |
12 | @Component({
13 | selector: 'sc-brand-footer',
14 | templateUrl: 'app/shared/brand-footer/brand.footer.component.html',
15 | styleUrls: ['app/shared/brand-footer/brand.footer.component.css'],
16 | })
17 | export class BrandFooterComponent {}
--------------------------------------------------------------------------------
/app/main.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file bootstraps the root module: AppModule.
5 | */
6 |
7 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
8 |
9 | import { AppModule } from './app.module';
10 |
11 | function launch() {
12 | const platform = platformBrowserDynamic();
13 | platform.bootstrapModule(AppModule);
14 | }
15 |
16 | if (window.hasOwnProperty('Office') && window.hasOwnProperty('Word')) {
17 |
18 | // Application-specific initialization code goes into a function that is
19 | // assigned to the Office.initialize event and runs after the Office.js initializes.
20 | // Bootstrapping of the AppModule must come AFTER Office has initialized.
21 | Office.initialize = reason => {
22 | launch();
23 | }
24 | }
25 | else {
26 | launch();
27 | }
28 |
--------------------------------------------------------------------------------
/app/settings/settings.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"settings.component.js","sourceRoot":"","sources":["settings.component.ts"],"names":[],"mappings":";AAAA,kHAAkH;;;;;;;;;;;;AAElH;;;;;EAKE;AAEF,sCAAgF;AAOhF,+EAA+E;AAC/E,kGAA+F;AAM/F;IAME,2BAAoB,eAAuC;QAAvC,oBAAe,GAAf,eAAe,CAAwB;IAAG,CAAC;IAE/D,2CAAe,GAAf;QACE,IAAI,yBAAyB,GAAW,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAExG,+EAA+E;QAC/E,8BAA8B;QAC9B,IAAI,yBAAyB,KAAK,eAAe,EAAE;YACjD,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAChE,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SAChF;IACH,CAAC;IAED,iDAAqB,GAArB,UAAsB,eAAuB,EAAE,KAAa;QAC1D,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAlBqB;QAApB,gBAAS,CAAC,QAAQ,CAAC;kCAAoB,iBAAU;gEAAC;IACvB;QAA3B,gBAAS,CAAC,eAAe,CAAC;kCAA2B,iBAAU;uEAAC;IAJvD,iBAAiB;QAJ7B,gBAAS,CAAC;YACP,WAAW,EAAE,sCAAsC;YACnD,SAAS,EAAE,CAAC,qCAAqC,CAAC;SACrD,CAAC;yCAOqC,iDAAsB;OANhD,iBAAiB,CAsB7B;IAAD,wBAAC;CAAA,AAtBD,IAsBC;AAtBY,8CAAiB"}
--------------------------------------------------------------------------------
/app/find-and-replace/find-and-replace.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo. */
2 |
3 | /*
4 | This file provides the styles for the find-and-replace view.
5 | */
6 |
7 | .ms-navigation {
8 | display: -webkit-flex;
9 | display: flex;
10 | -webkit-flex-direction: column;
11 | flex-direction: column;
12 | -webkit-flex-wrap: nowrap;
13 | flex-wrap: nowrap;
14 | height: 100%; }
15 |
16 | .ms-navigation__content {
17 | -webkit-flex: 1 0 0px;
18 | flex: 1 0 0px;
19 | padding-top: 15px;
20 | padding-left: 20px;
21 | padding-right: 20px;
22 | margin-top: 0px; }
23 |
24 | .ms-navigation__content p {
25 | padding-top: 10px; }
26 |
27 | .ms-navigation__content ul {
28 | list-style: none; }
29 |
30 | .ms-navigation__content__title, .ms-navigation__content__subtitle, .ms-navigation__content__text {
31 | margin-bottom: 20px; }
32 |
33 |
--------------------------------------------------------------------------------
/app/find-and-replace/find-and-replace.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"find-and-replace.component.js","sourceRoot":"","sources":["find-and-replace.component.ts"],"names":[],"mappings":";AAAA,6HAA6H;;;;;;;;;;;;AAE7H;;;EAGE;AAEF,sCAA4C;AAC5C,0CAAyC;AAOzC,0EAA0E;AAC1E,yFAAsF;AAEtF,gFAAgF;AAChF,kGAA+F;AAO/F;IAOI,iCAAoB,YAAiC,EACjC,eAAuC,EACvC,MAAc;QAFd,iBAAY,GAAZ,YAAY,CAAqB;QACjC,oBAAe,GAAf,eAAe,CAAwB;QACvC,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC,8DAA8D;IAC9D,qDAAmB,GAAnB,UAAoB,OAAe;QAC/B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,+DAA+D;IAC/D,sDAAoB,GAApB,UAAqB,OAAe;QAChC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IACjC,CAAC;IAED,mFAAmF;IACnF,2DAAyB,GAAzB,UAA0B,OAAe;QACrC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;IACrC,CAAC;IAED,yCAAO,GAAP;QACI,IAAI,CAAC,YAAY,CAAC,iCAAiC,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACvH,CAAC;IA5BQ,uBAAuB;QAJnC,gBAAS,CAAC;YACP,WAAW,EAAE,sDAAsD;YACnE,SAAS,EAAE,CAAC,qDAAqD,CAAC;SACrE,CAAC;yCAQoC,2CAAmB;YAChB,iDAAsB;YAC/B,eAAM;OATzB,uBAAuB,CA6BnC;IAAD,8BAAC;CAAA,AA7BD,IA6BC;AA7BY,0DAAuB"}
--------------------------------------------------------------------------------
/app/shared/office-fabric-component-wrappers/fabric.contextual.menu.wrapper.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/shared/office-fabric-component-wrappers/fabric.contextual.menu.wrapper.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | The file defines an Angular 2 component to wrap the Fabric ContextualMenu component.
5 | */
6 |
7 | import { Component, ElementRef } from '@angular/core';
8 | import { Router } from '@angular/router';
9 |
10 | // The WordDocumentService provides methods for manipulating the document.
11 | import { WordDocumentService } from '../../services/word-document/word.document.service';
12 |
13 | @Component({
14 | selector: 'of-contextual-menu',
15 | templateUrl: 'app/shared/office-fabric-component-wrappers/fabric.contextual.menu.wrapper.component.html',
16 | styleUrls:['app/shared/office-fabric-component-wrappers/fabric.contextual.menu.wrapper.component.css']
17 | })
18 | export class FabricContextualMenuWrapperComponent {
19 |
20 | constructor(private wordDocument: WordDocumentService,
21 | private router: Router,
22 | private element: ElementRef){ }
23 |
24 | insertSampleContent() {
25 | this.wordDocument.replaceDocumentContent([
26 | "Office Add-ins",
27 | "An OAI executes in an Office application and can interact with data in a document or mail item. As one observer said:",
28 | "\t\"The new OAI model is the cat's meow.\"",
29 | "An OAI is a web app that you can host anywhere. It runs in an Office application. A manifest.xml file specifies where the web app is located and how it should appear.",
30 | "You can find an OAI sample or two (or many) in the OfficeDev organization on GitHub."
31 | ]);
32 |
33 | this.closeMenu();
34 | }
35 |
36 | closeMenu() {
37 | let menuElement: HTMLElement = this.element.nativeElement // = this
38 | .children[0]; // =
39 | menuElement.classList.remove("is-open");
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/services/settings-storage/settings.storage.service.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | var __metadata = (this && this.__metadata) || function (k, v) {
10 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11 | };
12 | Object.defineProperty(exports, "__esModule", { value: true });
13 | exports.SettingsStorageService = void 0;
14 | /*
15 | This file defines a service that provides CRUD operations on application settings.
16 | */
17 | var core_1 = require("@angular/core");
18 | var SettingsStorageService = /** @class */ (function () {
19 | function SettingsStorageService() {
20 | }
21 | SettingsStorageService.prototype.store = function (specificKey, value) {
22 | window.localStorage.setItem(specificKey, value);
23 | };
24 | SettingsStorageService.prototype.fetch = function (specificKey) {
25 | return window.localStorage.getItem(specificKey);
26 | };
27 | SettingsStorageService.prototype.remove = function (specificKey) {
28 | window.localStorage.removeItem(specificKey);
29 | };
30 | SettingsStorageService = __decorate([
31 | core_1.Injectable(),
32 | __metadata("design:paramtypes", [])
33 | ], SettingsStorageService);
34 | return SettingsStorageService;
35 | }());
36 | exports.SettingsStorageService = SettingsStorageService;
37 | //# sourceMappingURL=settings.storage.service.js.map
--------------------------------------------------------------------------------
/app/shared/office-fabric-component-wrappers/TextField.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"TextField.js","sourceRoot":"","sources":["TextField.ts"],"names":[],"mappings":"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"}
--------------------------------------------------------------------------------
/app/settings/settings.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file defines a settings view. It is based on
5 | the settings sample, created by the Modern Assistance Experience Developer
6 | Docs team. Along with other samples, it is in the Office-Add-in-UX-Design-Patterns-Code
7 | repo: https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns-Code
8 | */
9 |
10 | import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core';
11 | import { Router } from '@angular/router';
12 |
13 | import { NavigationHeaderComponent} from '../shared/navigation-header/navigation.header.component';
14 | import { ButtonComponent } from '../shared/button/button.component';
15 | import { BrandFooterComponent} from '../shared/brand-footer/brand.footer.component';
16 |
17 | // The SettingsStorageService provides CRUD operations on application settings.
18 | import { SettingsStorageService } from '../services/settings-storage/settings.storage.service';
19 |
20 | @Component({
21 | templateUrl: 'app/settings/settings.component.html',
22 | styleUrls: ['app/settings/settings.component.css']
23 | })
24 | export class SettingsComponent {
25 |
26 | // Get references to the radio buttons so we can toggle which is selected.
27 | @ViewChild('always') alwaysRadioButton: ElementRef;
28 | @ViewChild('onlyFirstTime') onlyFirstTimeRadioButton: ElementRef;
29 |
30 | constructor(private settingsStorage: SettingsStorageService) {}
31 |
32 | ngAfterViewInit() {
33 | let currentInstructionSetting: string = this.settingsStorage.fetch("StyleCheckerAddinShowInstructions");
34 |
35 | // Ensure that when the settings view loads, the radio button selection matches
36 | // the user's current setting.
37 | if (currentInstructionSetting === "OnlyFirstTime") {
38 | this.alwaysRadioButton.nativeElement.removeAttribute("checked");
39 | this.onlyFirstTimeRadioButton.nativeElement.setAttribute("checked", "checked");
40 | }
41 | }
42 |
43 | onRadioButtonSelected(specificSetting: string, value: string){
44 | this.settingsStorage.store(specificSetting, value);
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/app/shared/star.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var StarComponent = (function () {
13 | function StarComponent() {
14 | this.ratingClicked = new core_1.EventEmitter();
15 | }
16 | StarComponent.prototype.ngOnChanges = function () {
17 | // Convert x out of 5 starts
18 | // to y out of 86px width
19 | this.starWidth = this.rating * 86 / 5;
20 | };
21 | StarComponent.prototype.onClick = function () {
22 | this.ratingClicked.emit("The rating " + this.rating + " was clicked!");
23 | };
24 | __decorate([
25 | core_1.Input(),
26 | __metadata('design:type', String)
27 | ], StarComponent.prototype, "innerlabel", void 0);
28 | __decorate([
29 | core_1.Input(),
30 | __metadata('design:type', Number)
31 | ], StarComponent.prototype, "rating", void 0);
32 | __decorate([
33 | core_1.Output(),
34 | __metadata('design:type', core_1.EventEmitter)
35 | ], StarComponent.prototype, "ratingClicked", void 0);
36 | StarComponent = __decorate([
37 | core_1.Component({
38 | selector: 'ai-star',
39 | templateUrl: 'app/shared/star.component.html',
40 | styleUrls: ['app/shared/star.component.css']
41 | }),
42 | __metadata('design:paramtypes', [])
43 | ], StarComponent);
44 | return StarComponent;
45 | }());
46 | exports.StarComponent = StarComponent;
47 | //# sourceMappingURL=star.component.js.map
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [
5 | true,
6 | "check-space"
7 | ],
8 | "curly": true,
9 | "eofline": true,
10 | "forin": true,
11 | "indent": [
12 | true,
13 | "spaces"
14 | ],
15 | "label-position": true,
16 | "label-undefined": true,
17 | "max-line-length": [
18 | true,
19 | 140
20 | ],
21 | "member-access": false,
22 | "member-ordering": [
23 | true,
24 | "static-before-instance",
25 | "variables-before-functions"
26 | ],
27 | "no-arg": true,
28 | "no-bitwise": true,
29 | "no-console": [
30 | true,
31 | "debug",
32 | "info",
33 | "time",
34 | "timeEnd",
35 | "trace"
36 | ],
37 | "no-construct": true,
38 | "no-debugger": true,
39 | "no-duplicate-key": true,
40 | "no-duplicate-variable": true,
41 | "no-empty": false,
42 | "no-eval": true,
43 | "no-inferrable-types": true,
44 | "no-shadowed-variable": true,
45 | "no-string-literal": false,
46 | "no-switch-case-fall-through": true,
47 | "no-trailing-whitespace": true,
48 | "no-unused-expression": true,
49 | "no-unused-variable": true,
50 | "no-unreachable": true,
51 | "no-use-before-declare": true,
52 | "no-var-keyword": true,
53 | "object-literal-sort-keys": false,
54 | "one-line": [
55 | true,
56 | "check-open-brace",
57 | "check-catch",
58 | "check-else",
59 | "check-whitespace"
60 | ],
61 | "quotemark": [
62 | true,
63 | "single"
64 | ],
65 | "radix": true,
66 | "semicolon": [
67 | "always"
68 | ],
69 | "triple-equals": [
70 | true,
71 | "allow-null-check"
72 | ],
73 | "typedef-whitespace": [
74 | true,
75 | {
76 | "call-signature": "nospace",
77 | "index-signature": "nospace",
78 | "parameter": "nospace",
79 | "property-declaration": "nospace",
80 | "variable-declaration": "nospace"
81 | }
82 | ],
83 | "variable-name": false,
84 | "whitespace": [
85 | true,
86 | "check-branch",
87 | "check-decl",
88 | "check-operator",
89 | "check-separator",
90 | "check-type"
91 | ]
92 | }
93 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Word-Add-in-Angular2-StyleChecker",
3 | "version": "1.0.1",
4 | "author": "CALC Developer Education Office Add-ins Team",
5 | "description": "Package for the Style Checker sample Word Add-in",
6 | "scripts": {
7 | "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
8 | "tsc": "tsc",
9 | "tsc:w": "tsc -w",
10 | "lint": "tslint ./app/**/*.ts -t verbose",
11 | "lite": "lite-server -c bs-config.json"
12 | },
13 | "license": "MIT",
14 | "dependencies": {
15 | "@angular/common": "^5.2.9",
16 | "@angular/compiler": "^5.2.9",
17 | "@angular/core": "^11.0.5",
18 | "@angular/platform-browser": "^5.2.9",
19 | "@angular/platform-browser-dynamic": "^5.2.9",
20 | "@angular/router": "^5.2.9",
21 | "@angular/upgrade": "^5.2.9",
22 | "core-js": "^2.4.1",
23 | "reflect-metadata": "^0.1.8",
24 | "rxjs": "5.5.12",
25 | "systemjs": "0.19.39",
26 | "zone.js": "^0.6.25"
27 | },
28 | "devDependencies": {
29 | "@babel/core": "^7.11.6",
30 | "@babel/polyfill": "^7.11.5",
31 | "@babel/preset-env": "^7.11.5",
32 | "@types/find-process": "1.2.0",
33 | "@types/office-js": "^1.0.108",
34 | "@types/office-runtime": "^1.0.14",
35 | "babel-loader": "^8.3.0",
36 | "clean-webpack-plugin": "^3.0.0",
37 | "concurrently": "^3.0.0",
38 | "copy-webpack-plugin": "^6.1.1",
39 | "eslint-config-office-addins": "^1.0.19",
40 | "find-process": "^1.4.3",
41 | "file-loader": "^6.2.0",
42 | "lite-server": "^2.2.2",
43 | "html-loader": "^4.2.0",
44 | "html-webpack-plugin": "^5.5.0",
45 | "office-addin-cli": "^1.0.13",
46 | "office-addin-debugging": "^3.0.34",
47 | "office-addin-dev-certs": "^1.5.5",
48 | "office-addin-lint": "^1.0.26",
49 | "office-addin-manifest": "1.5.7",
50 | "office-addin-prettier-config": "^1.0.12",
51 | "source-map-loader": "^4.0.1",
52 | "ts-loader": "^9.4.2",
53 | "typescript": "^4.0.3",
54 | "webpack": "^5.76.0",
55 | "webpack-cli": "^5.0.1",
56 | "webpack-dev-server": "^4.11.1"
57 | },
58 | "repository": {}
59 | }
60 |
--------------------------------------------------------------------------------
/app/instructions/instruction-step.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var router_1 = require('@angular/router');
13 | var button_component_1 = require('../shared/button.component');
14 | var InstructionStepsComponent = (function () {
15 | function InstructionStepsComponent() {
16 | this.title = "WELCOME";
17 | this.addin_description = "Style Checker enables you to enforce style rules while exempting paragraphs that you specify from the rules.";
18 | this.steps_intro = "Just take these steps:";
19 | this.steps = [{ step_number: 1, content: "Enter a string in the Find box." },
20 | { step_number: 2, content: "Enter a replacement string in the Replace With box." },
21 | { step_number: 3, content: "Enter the zero-based numbers of the parapgraphs that should be exempt in the Skip Paragraphs box." },
22 | { step_number: 4, content: "Press Replace." }];
23 | }
24 | InstructionStepsComponent = __decorate([
25 | core_1.Component({
26 | templateUrl: 'app/instructions/instruction-steps.component.html',
27 | directives: [button_component_1.ButtonComponent, router_1.ROUTER_DIRECTIVES],
28 | styleUrls: ['app/instructions/instruction-steps.component.css'],
29 | }),
30 | __metadata('design:paramtypes', [])
31 | ], InstructionStepsComponent);
32 | return InstructionStepsComponent;
33 | }());
34 | exports.InstructionStepsComponent = InstructionStepsComponent;
35 | //# sourceMappingURL=instruction-step.component.js.map
--------------------------------------------------------------------------------
/app/app.module.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
2 |
3 | /*
4 | This file brings together all of the required modules and components and identifies
5 | the component to be bootstrapped.
6 | */
7 |
8 | import { NgModule } from '@angular/core';
9 | import { BrowserModule } from '@angular/platform-browser';
10 | import { AppRoutingModule } from './app-routing.module';
11 |
12 | // Import all the custom components.
13 | import { AppComponent } from './app.component';
14 | import { FindAndReplaceComponent } from './find-and-replace/find-and-replace.component';
15 | import { InstructionStepsComponent } from './instructions/instruction-steps.component';
16 | import { SettingsComponent } from './settings/settings.component';
17 | import { ButtonComponent } from './shared/button/button.component';
18 | import { NavigationHeaderComponent} from './shared/navigation-header/navigation.header.component';
19 | import { BrandFooterComponent} from './shared/brand-footer/brand.footer.component';
20 | import { ContextualMenuButtonComponent } from './shared/contextual-menu-button/contextual.menu.button.component';
21 | import { FabricContextualMenuWrapperComponent } from './shared/office-fabric-component-wrappers/fabric.contextual.menu.wrapper.component';
22 | import { FabricTextFieldWrapperComponent } from './shared/office-fabric-component-wrappers/fabric.textfield.wrapper.component';
23 |
24 | // The WordDocumentService provides methods for manipulating the document.
25 | import { WordDocumentService } from './services/word-document/word.document.service';
26 |
27 | // The SettingsStorageService provides CRUD operations on application settings.
28 | import { SettingsStorageService } from './services/settings-storage/settings.storage.service';
29 |
30 |
31 | @NgModule({
32 | imports: [
33 | BrowserModule,
34 | AppRoutingModule
35 | ],
36 | declarations: [
37 | AppComponent,
38 | FindAndReplaceComponent,
39 | InstructionStepsComponent,
40 | SettingsComponent,
41 | ButtonComponent,
42 | NavigationHeaderComponent,
43 | BrandFooterComponent,
44 | ContextualMenuButtonComponent,
45 | FabricContextualMenuWrapperComponent,
46 | FabricTextFieldWrapperComponent
47 | ],
48 | providers: [
49 | WordDocumentService,
50 | SettingsStorageService
51 | ],
52 | bootstrap: [ AppComponent ]
53 | })
54 | export class AppModule { }
--------------------------------------------------------------------------------
/app/shared/contextual-menu-button/contextual.menu.button.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | var __metadata = (this && this.__metadata) || function (k, v) {
10 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11 | };
12 | Object.defineProperty(exports, "__esModule", { value: true });
13 | exports.ContextualMenuButtonComponent = void 0;
14 | /*
15 | This file defines a component that provides a button that opens a contextual menu.
16 | */
17 | var core_1 = require("@angular/core");
18 | var ContextualMenuButtonComponent = /** @class */ (function () {
19 | function ContextualMenuButtonComponent(element) {
20 | this.element = element;
21 | }
22 | ContextualMenuButtonComponent.prototype.toggleDropDown = function () {
23 | var menuElement = this.element.nativeElement // = this
24 | .nextSibling // = an empty text node
25 | .nextSibling // =
26 | .children[0]; // =
27 | menuElement.classList.toggle("is-open");
28 | };
29 | ContextualMenuButtonComponent = __decorate([
30 | core_1.Component({
31 | selector: 'sc-contextual-menu-button',
32 | templateUrl: 'app/shared/contextual-menu-button/contextual.menu.button.component.html',
33 | styleUrls: ['app/shared/contextual-menu-button/contextual.menu.button.component.css'],
34 | }),
35 | __metadata("design:paramtypes", [core_1.ElementRef])
36 | ], ContextualMenuButtonComponent);
37 | return ContextualMenuButtonComponent;
38 | }());
39 | exports.ContextualMenuButtonComponent = ContextualMenuButtonComponent;
40 | //# sourceMappingURL=contextual.menu.button.component.js.map
--------------------------------------------------------------------------------
/app/find-and-replace/find-and-replace.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
2 |
3 | /*
4 | This file defines a component that enables a search-and-replace functionality for
5 | the Word document.
6 | */
7 |
8 | import { Component, } from '@angular/core';
9 | import { Router } from '@angular/router';
10 |
11 | import { FabricTextFieldWrapperComponent } from '../shared/office-fabric-component-wrappers/fabric.textfield.wrapper.component';
12 | import { ButtonComponent } from '../shared/button/button.component';
13 | import { NavigationHeaderComponent} from '../shared/navigation-header/navigation.header.component';
14 | import { BrandFooterComponent} from '../shared/brand-footer/brand.footer.component';
15 |
16 | // The WordDocumentService provides methods for manipulating the document.
17 | import { WordDocumentService } from '../services/word-document/word.document.service';
18 |
19 | // The SettingsStorageService provides CRUD operations on application settings..
20 | import { SettingsStorageService } from '../services/settings-storage/settings.storage.service';
21 |
22 |
23 | @Component({
24 | templateUrl: 'app/find-and-replace/find-and-replace.component.html',
25 | styleUrls: ['app/find-and-replace/find-and-replace.component.css'],
26 | })
27 | export class FindAndReplaceComponent {
28 |
29 | private searchString: string;
30 | private replaceString: string;
31 | private excludedParagraph: number;
32 | private subscription: any;
33 |
34 | constructor(private wordDocument: WordDocumentService,
35 | private settingsStorage: SettingsStorageService,
36 | private router: Router) {}
37 |
38 | // Handle the event of a user entering text in the search box.
39 | onSearchTextEntered(message: string): void {
40 | this.searchString = message;
41 | }
42 |
43 | // Handle the event of a user entering text in the replace box.
44 | onReplaceTextEntered(message: string): void {
45 | this.replaceString = message;
46 | }
47 |
48 | // Handle the event of a user entering a number in the box for excluded paragraphs.
49 | onParagraphNumeralEntered(message: number): void {
50 | this.excludedParagraph = message;
51 | }
52 |
53 | replace(): void {
54 | this.wordDocument.replaceFoundStringsWithExceptions(this.searchString, this.replaceString, this.excludedParagraph);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/services/word-document/word.document.service.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"word.document.service.js","sourceRoot":"","sources":["word.document.service.ts"],"names":[],"mappings":"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"}
--------------------------------------------------------------------------------
/app/shared/brand-footer/brand.footer.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo. */
2 |
3 | /*
4 | This file provides the styles for branded footer.
5 | */
6 |
7 | .ms-landing-page {
8 | display: -webkit-flex;
9 | display: flex;
10 | -webkit-flex-direction: column;
11 | flex-direction: column;
12 | -webkit-flex-wrap: nowrap;
13 | flex-wrap: nowrap;
14 | height: 100%; }
15 |
16 | .ms-landing-page__footer {
17 | display: -webkit-inline-flex;
18 | display: inline-flex;
19 | -webkit-justify-content: center;
20 | justify-content: center;
21 | -webkit-align-items: center;
22 | align-items: center;
23 | position: absolute;
24 | bottom: 0;}
25 |
26 | .ms-landing-page__footer--left {
27 | transition: background ease 0.1s, color ease 0.1s;
28 | display: -webkit-inline-flex;
29 | display: inline-flex;
30 | -webkit-justify-content: flex-start;
31 | justify-content: flex-start;
32 | -webkit-align-items: center;
33 | align-items: center;
34 | -webkit-flex: 1 0 0px;
35 | flex: 1 0 0px;
36 | padding: 20px; }
37 |
38 | .ms-landing-page__footer--left:active, .ms-landing-page__footer--left:hover {
39 | background: #005ca4;
40 | cursor: pointer; }
41 |
42 | .ms-landing-page__footer--left:active {
43 | background: #005ca4; }
44 |
45 | .ms-landing-page__footer--left--disabled {
46 | opacity: 0.6;
47 | pointer-events: none;
48 | cursor: not-allowed; }
49 |
50 | .ms-landing-page__footer--left--disabled:active, .ms-landing-page__footer--left--disabled:hover {
51 | background: transparent; }
52 |
53 | .ms-landing-page__footer--left img {
54 | width: 40px;
55 | height: 40px; }
56 |
57 | .ms-landing-page__footer--left h1 {
58 | -webkit-flex: 1 0 0px;
59 | flex: 1 0 0px;
60 | margin-left: 15px;
61 | text-align: left;
62 | width: auto;
63 | max-width: auto;
64 | overflow: hidden;
65 | white-space: nowrap;
66 | text-overflow: ellipsis; }
67 |
68 | .ms-landing-page__footer--right {
69 | transition: background ease 0.1s, color ease 0.1s;
70 | padding: 29px 20px; }
71 |
72 | .ms-landing-page__footer--right:active, .ms-landing-page__footer--right:hover {
73 | background: #005ca4;
74 | cursor: pointer; }
75 |
76 | .ms-landing-page__footer--right:active {
77 | background: #005ca4; }
78 |
79 | .ms-landing-page__footer--right--disabled {
80 | opacity: 0.6;
81 | pointer-events: none;
82 | cursor: not-allowed; }
83 |
84 | .ms-landing-page__footer--right--disabled:active, .ms-landing-page__footer--right--disabled:hover {
85 | background: transparent; }
86 |
87 |
--------------------------------------------------------------------------------
/app/instructions/instruction-steps.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | var __metadata = (this && this.__metadata) || function (k, v) {
10 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11 | };
12 | Object.defineProperty(exports, "__esModule", { value: true });
13 | exports.InstructionStepsComponent = void 0;
14 | /*
15 | This file defines an instructions component for a task pane page. It is based on
16 | the instruction-step sample, created by the Modern Assistance Experience Developer
17 | Docs team. Along with other samples, it is in the Office-Add-in-UX-Design-Patterns-Code
18 | repo: https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns-Code
19 | */
20 | var core_1 = require("@angular/core");
21 | var router_1 = require("@angular/router");
22 | var InstructionStepsComponent = /** @class */ (function () {
23 | function InstructionStepsComponent(router) {
24 | this.router = router;
25 | this.title = "WELCOME";
26 | this.addin_description = "Style Checker enables you to enforce style rules while exempting paragraphs that you specify from the rules.";
27 | this.steps_intro = "Just take these steps:";
28 | this.steps = [{ step_number: 1, content: "Enter a string in the Find box." },
29 | { step_number: 2, content: "Enter a replacement string in the Replace With box." },
30 | { step_number: 3, content: "Enter the zero-based numbers of the parapgraphs that should be exempt in the Skip Paragraphs box." },
31 | { step_number: 4, content: "Press Replace." }];
32 | }
33 | InstructionStepsComponent = __decorate([
34 | core_1.Component({
35 | templateUrl: 'app/instructions/instruction-steps.component.html',
36 | styleUrls: ['app/instructions/instruction-steps.component.css']
37 | }),
38 | __metadata("design:paramtypes", [router_1.Router])
39 | ], InstructionStepsComponent);
40 | return InstructionStepsComponent;
41 | }());
42 | exports.InstructionStepsComponent = InstructionStepsComponent;
43 | //# sourceMappingURL=instruction-steps.component.js.map
--------------------------------------------------------------------------------
/app/app-routing.module.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | Object.defineProperty(exports, "__esModule", { value: true });
10 | exports.AppRoutingModule = void 0;
11 | /*
12 | This file defines the routes of the application.
13 | */
14 | var core_1 = require("@angular/core");
15 | var router_1 = require("@angular/router");
16 | var find_and_replace_component_1 = require("./find-and-replace/find-and-replace.component");
17 | var instruction_steps_component_1 = require("./instructions/instruction-steps.component");
18 | var settings_component_1 = require("./settings/settings.component");
19 | function fetchInstructionSetting() {
20 | return window.localStorage.getItem("StyleCheckerAddinShowInstructions");
21 | }
22 | function setRoutesArray() {
23 | var routesArray = [
24 | { path: 'instruction-steps', component: instruction_steps_component_1.InstructionStepsComponent },
25 | { path: 'settings', component: settings_component_1.SettingsComponent },
26 | { path: 'find-and-replace', component: find_and_replace_component_1.FindAndReplaceComponent }
27 | ];
28 | var defaultRoute = { path: '', redirectTo: '/instruction-steps', pathMatch: 'full' };
29 | // If a user has set the application to skip the instruction view,
30 | // then set the default route to the search and replace view.
31 | if (fetchInstructionSetting() === "OnlyFirstTime") {
32 | defaultRoute = { path: '', redirectTo: '/find-and-replace', pathMatch: 'full' };
33 | }
34 | routesArray.unshift(defaultRoute);
35 | return routesArray;
36 | }
37 | var routes = setRoutesArray();
38 | var AppRoutingModule = /** @class */ (function () {
39 | function AppRoutingModule() {
40 | }
41 | AppRoutingModule = __decorate([
42 | core_1.NgModule({
43 | imports: [router_1.RouterModule.forRoot(routes,
44 | // Use hash location strategy in an Office Add-in
45 | { useHash: true })],
46 | exports: [router_1.RouterModule]
47 | })
48 | ], AppRoutingModule);
49 | return AppRoutingModule;
50 | }());
51 | exports.AppRoutingModule = AppRoutingModule;
52 | //# sourceMappingURL=app-routing.module.js.map
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Security
4 |
5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6 |
7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8 |
9 | ## Reporting Security Issues
10 |
11 | **Please do not report security vulnerabilities through public GitHub issues.**
12 |
13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14 |
15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16 |
17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18 |
19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20 |
21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22 | * Full paths of source file(s) related to the manifestation of the issue
23 | * The location of the affected source code (tag/branch/commit or direct URL)
24 | * Any special configuration required to reproduce the issue
25 | * Step-by-step instructions to reproduce the issue
26 | * Proof-of-concept or exploit code (if possible)
27 | * Impact of the issue, including how an attacker might exploit the issue
28 |
29 | This information will help us triage your report more quickly.
30 |
31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32 |
33 | ## Preferred Languages
34 |
35 | We prefer all communications to be in English.
36 |
37 | ## Policy
38 |
39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/instructions/instruction-steps.component.css:
--------------------------------------------------------------------------------
1 | /* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo. */
2 |
3 | /*
4 | This file provides the styles for the instructions view.
5 | */
6 |
7 | .ms-firstrun-instructionstep {
8 | display: -webkit-flex;
9 | display: flex;
10 | -webkit-flex-direction: column;
11 | flex-direction: column;
12 | -webkit-flex-wrap: nowrap;
13 | flex-wrap: nowrap;
14 | height: 100%;
15 | min-height: 600px; }
16 |
17 | .ms-firstrun-instructionstep__header {
18 | padding: 20px;
19 | min-height: 20px;
20 | display: -webkit-flex;
21 | display: flex;
22 | -webkit-flex-direction: column;
23 | flex-direction: column;
24 | -webkit-flex-wrap: nowrap;
25 | flex-wrap: nowrap; }
26 |
27 | .ms-firstrun-instructionstep__header h1 {
28 | letter-spacing: 5px; }
29 |
30 | .ms-firstrun-instructionstep__header p {
31 | margin-top: 15px; }
32 |
33 | .ms-firstrun-instructionstep__header--image {
34 | background: transparent no-repeat center center;
35 | background-image: url("./app/assets/images/blue-pencil-logo.png");
36 | background-size: cover;
37 | margin-top: 15px;
38 | display: -webkit-flex;
39 | display: flex;
40 | -webkit-flex-direction: column;
41 | flex-direction: column;
42 | -webkit-flex-wrap: nowrap;
43 | flex-wrap: nowrap;
44 | -webkit-justify-content: stretch;
45 | justify-content: stretch;
46 | -webkit-align-items: stretch;
47 | align-items: stretch;
48 | -webkit-flex: 0 1 0;
49 | flex: 0 1 0;
50 | min-height: 180px;
51 | max-width: 200px;}
52 |
53 | .ms-firstrun-instructionstep__welcome-body {
54 | padding-left: 20px; }
55 |
56 | .ms-firstrun-instructionstep__welcome-intro {
57 | padding-top: 6px;
58 | padding-bottom: 20px; }
59 | .ms-firstrun-instructionstep__list {
60 | list-style-type: none; }
61 |
62 | .ms-firstrun-instructionstep__list.ms-List .ms-ListItem {
63 | padding: 0;
64 | margin: 0;
65 | margin-bottom: 20px; }
66 |
67 | .ms-firstrun-instructionstep__list.ms-List .ms-ListItem-primaryText {
68 | color: #0077d6;
69 | background-color: #c6dff3;
70 | border-radius: 100%;
71 | font-size: 12pt;
72 | width: 30px;
73 | height: 30px;
74 | line-height: 30px;
75 | padding: 0;
76 | text-align: center;
77 | position: absolute;}
78 |
79 | .ms-firstrun-instructionstep__list.ms-List .ms-ListItem-secondaryText {
80 | color: #333333;
81 | margin-bottom: 10px;
82 | position: inherit;
83 | top: 0;
84 | /* override fabric positioning */
85 | padding-left: 40px;
86 | /* Offset by 30px + 10px so that large bullets are aligned properly. */
87 | white-space: normal;
88 | overflow: auto;
89 | line-height: normal; }
90 |
91 | .ms-firstrun-instructionstep__list li {
92 | margin-bottom: 20px; }
93 |
94 | .ms-firstrun-instructionstep__list li i {
95 | position: relative;
96 | top: 2px;
97 | margin-right: 10px; }
98 |
--------------------------------------------------------------------------------
/app/settings/settings.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | var __metadata = (this && this.__metadata) || function (k, v) {
10 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11 | };
12 | Object.defineProperty(exports, "__esModule", { value: true });
13 | exports.SettingsComponent = void 0;
14 | /*
15 | This file defines a settings view. It is based on
16 | the settings sample, created by the Modern Assistance Experience Developer
17 | Docs team. Along with other samples, it is in the Office-Add-in-UX-Design-Patterns-Code
18 | repo: https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns-Code
19 | */
20 | var core_1 = require("@angular/core");
21 | // The SettingsStorageService provides CRUD operations on application settings.
22 | var settings_storage_service_1 = require("../services/settings-storage/settings.storage.service");
23 | var SettingsComponent = /** @class */ (function () {
24 | function SettingsComponent(settingsStorage) {
25 | this.settingsStorage = settingsStorage;
26 | }
27 | SettingsComponent.prototype.ngAfterViewInit = function () {
28 | var currentInstructionSetting = this.settingsStorage.fetch("StyleCheckerAddinShowInstructions");
29 | // Ensure that when the settings view loads, the radio button selection matches
30 | // the user's current setting.
31 | if (currentInstructionSetting === "OnlyFirstTime") {
32 | this.alwaysRadioButton.nativeElement.removeAttribute("checked");
33 | this.onlyFirstTimeRadioButton.nativeElement.setAttribute("checked", "checked");
34 | }
35 | };
36 | SettingsComponent.prototype.onRadioButtonSelected = function (specificSetting, value) {
37 | this.settingsStorage.store(specificSetting, value);
38 | };
39 | __decorate([
40 | core_1.ViewChild('always'),
41 | __metadata("design:type", core_1.ElementRef)
42 | ], SettingsComponent.prototype, "alwaysRadioButton", void 0);
43 | __decorate([
44 | core_1.ViewChild('onlyFirstTime'),
45 | __metadata("design:type", core_1.ElementRef)
46 | ], SettingsComponent.prototype, "onlyFirstTimeRadioButton", void 0);
47 | SettingsComponent = __decorate([
48 | core_1.Component({
49 | templateUrl: 'app/settings/settings.component.html',
50 | styleUrls: ['app/settings/settings.component.css']
51 | }),
52 | __metadata("design:paramtypes", [settings_storage_service_1.SettingsStorageService])
53 | ], SettingsComponent);
54 | return SettingsComponent;
55 | }());
56 | exports.SettingsComponent = SettingsComponent;
57 | //# sourceMappingURL=settings.component.js.map
--------------------------------------------------------------------------------
/app/shared/office-fabric-component-wrappers/TextField.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information.
2 |
3 | "use strict";
4 |
5 | // Modification to default file: Remove the wrapping namespace when you use the
6 | // file in an Angular 2 application. It is not needed and namespaces don't play
7 | // well with modules in Angular 2.
8 |
9 | //namespace fabric {
10 |
11 | module TextFieldConsts {
12 | export enum Type {
13 | Placeholder,
14 | Underlined
15 | }
16 | }
17 |
18 |
19 | /**
20 | * Text Field Plugin
21 | *
22 | * Adds basic demonstration functionality to .ms-TextField components.
23 | */
24 | export class TextField {
25 |
26 | private _container: HTMLElement;
27 | public _textField: HTMLInputElement;
28 | private _textFieldLabel: HTMLElement;
29 | private _type: TextFieldConsts.Type[];
30 |
31 | /**
32 | *
33 | * @param {HTMLDivElement} container - the target container for an instance of TextField
34 | * @constructor
35 | */
36 | constructor(container: HTMLElement) {
37 | this._container = container;
38 | this._type = [];
39 | this._textField = this._container.querySelector(".ms-TextField-field");
40 | this._textFieldLabel = this._container.querySelector(".ms-Label");
41 | this._setTextFieldType();
42 | this._addListeners();
43 | }
44 |
45 | /** Populate _type with various kinds of text fields */
46 | private _setTextFieldType(): void {
47 | if (this._container.classList.contains("ms-TextField--placeholder")) {
48 | this._type.push(TextFieldConsts.Type.Placeholder);
49 | }
50 | if (this._container.classList.contains("ms-TextField--underlined")) {
51 | this._type.push(TextFieldConsts.Type.Underlined);
52 | }
53 | }
54 |
55 | /** Add event listeners according to the type(s) of text field */
56 | private _addListeners(): void {
57 |
58 | /** Placeholder - hide/unhide the placeholder */
59 | if (this._type.indexOf(TextFieldConsts.Type.Placeholder) >= 0) {
60 | this._textField.addEventListener("focus", (event: MouseEvent) => {
61 | this._textFieldLabel.style.display = "none";
62 | });
63 | // Modify default Fabric code to ensure that the text box gets focus when the
64 | // the placeholder text itself is clicked.
65 | this._textFieldLabel.addEventListener("click", (event: MouseEvent) => {
66 | this._textField.focus();
67 | });
68 | this._textField.addEventListener("blur", (event: MouseEvent) => {
69 | // Show only if no value in the text field
70 | if (this._textField.value.length === 0) {
71 | this._textFieldLabel.style.display = "block";
72 | }
73 | });
74 | }
75 | /** Underlined - adding/removing a focus class */
76 | if (this._type.indexOf(TextFieldConsts.Type.Underlined) >= 0) {
77 | this._textField.addEventListener("focus", (event: MouseEvent) => {
78 | this._container.classList.add("is-active");
79 | });
80 | this._textField.addEventListener("blur", (event: MouseEvent) => {
81 | this._container.classList.remove("is-active");
82 | });
83 | }
84 | }
85 | }
86 | //}
87 |
--------------------------------------------------------------------------------
/app/find-and-replace/find-and-replace.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | var __metadata = (this && this.__metadata) || function (k, v) {
10 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11 | };
12 | Object.defineProperty(exports, "__esModule", { value: true });
13 | exports.FindAndReplaceComponent = void 0;
14 | /*
15 | This file defines a component that enables a search-and-replace functionality for
16 | the Word document.
17 | */
18 | var core_1 = require("@angular/core");
19 | var router_1 = require("@angular/router");
20 | // The WordDocumentService provides methods for manipulating the document.
21 | var word_document_service_1 = require("../services/word-document/word.document.service");
22 | // The SettingsStorageService provides CRUD operations on application settings..
23 | var settings_storage_service_1 = require("../services/settings-storage/settings.storage.service");
24 | var FindAndReplaceComponent = /** @class */ (function () {
25 | function FindAndReplaceComponent(wordDocument, settingsStorage, router) {
26 | this.wordDocument = wordDocument;
27 | this.settingsStorage = settingsStorage;
28 | this.router = router;
29 | }
30 | // Handle the event of a user entering text in the search box.
31 | FindAndReplaceComponent.prototype.onSearchTextEntered = function (message) {
32 | this.searchString = message;
33 | };
34 | // Handle the event of a user entering text in the replace box.
35 | FindAndReplaceComponent.prototype.onReplaceTextEntered = function (message) {
36 | this.replaceString = message;
37 | };
38 | // Handle the event of a user entering a number in the box for excluded paragraphs.
39 | FindAndReplaceComponent.prototype.onParagraphNumeralEntered = function (message) {
40 | this.excludedParagraph = message;
41 | };
42 | FindAndReplaceComponent.prototype.replace = function () {
43 | this.wordDocument.replaceFoundStringsWithExceptions(this.searchString, this.replaceString, this.excludedParagraph);
44 | };
45 | FindAndReplaceComponent = __decorate([
46 | core_1.Component({
47 | templateUrl: 'app/find-and-replace/find-and-replace.component.html',
48 | styleUrls: ['app/find-and-replace/find-and-replace.component.css'],
49 | }),
50 | __metadata("design:paramtypes", [word_document_service_1.WordDocumentService,
51 | settings_storage_service_1.SettingsStorageService,
52 | router_1.Router])
53 | ], FindAndReplaceComponent);
54 | return FindAndReplaceComponent;
55 | }());
56 | exports.FindAndReplaceComponent = FindAndReplaceComponent;
57 | //# sourceMappingURL=find-and-replace.component.js.map
--------------------------------------------------------------------------------
/app/shared/office-fabric-component-wrappers/fabric.contextual.menu.wrapper.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo.
3 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7 | return c > 3 && r && Object.defineProperty(target, key, r), r;
8 | };
9 | var __metadata = (this && this.__metadata) || function (k, v) {
10 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11 | };
12 | Object.defineProperty(exports, "__esModule", { value: true });
13 | exports.FabricContextualMenuWrapperComponent = void 0;
14 | /*
15 | The file defines an Angular 2 component to wrap the Fabric ContextualMenu component.
16 | */
17 | var core_1 = require("@angular/core");
18 | var router_1 = require("@angular/router");
19 | // The WordDocumentService provides methods for manipulating the document.
20 | var word_document_service_1 = require("../../services/word-document/word.document.service");
21 | var FabricContextualMenuWrapperComponent = /** @class */ (function () {
22 | function FabricContextualMenuWrapperComponent(wordDocument, router, element) {
23 | this.wordDocument = wordDocument;
24 | this.router = router;
25 | this.element = element;
26 | }
27 | FabricContextualMenuWrapperComponent.prototype.insertSampleContent = function () {
28 | this.wordDocument.replaceDocumentContent([
29 | "Office Add-ins",
30 | "An OAI executes in an Office application and can interact with data in a document or mail item. As one observer said:",
31 | "\t\"The new OAI model is the cat's meow.\"",
32 | "An OAI is a web app that you can host anywhere. It runs in an Office application. A manifest.xml file specifies where the web app is located and how it should appear.",
33 | "You can find an OAI sample or two (or many) in the OfficeDev organization on GitHub."
34 | ]);
35 | this.closeMenu();
36 | };
37 | FabricContextualMenuWrapperComponent.prototype.closeMenu = function () {
38 | var menuElement = this.element.nativeElement // = this
39 | .children[0]; // =