Skip to content

Commit 4b38aea

Browse files
authored
Merge pull request #99 from akrantz/ribbon
use ribbon buttons to open task pane
2 parents ca6a521 + e47d18f commit 4b38aea

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed

manifest.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,42 @@
3939
<Namespace resid="Contoso.Functions.Namespace" />
4040
</ExtensionPoint>
4141
</AllFormFactors>
42+
<DesktopFormFactor>
43+
<GetStarted>
44+
<Title resid="Contoso.GetStarted.Title"/>
45+
<Description resid="Contoso.GetStarted.Description"/>
46+
<LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
47+
</GetStarted>
48+
<FunctionFile resid="Contoso.Ribbon.Url" />
49+
<ExtensionPoint xsi:type="PrimaryCommandSurface">
50+
<OfficeTab id="TabHome">
51+
<Group id="Contoso.Group1">
52+
<Label resid="Contoso.Group1Label" />
53+
<Icon>
54+
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
55+
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
56+
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
57+
</Icon>
58+
<Control xsi:type="Button" id="Contoso.TaskpaneButton">
59+
<Label resid="Contoso.TaskpaneButton.Label" />
60+
<Supertip>
61+
<Title resid="Contoso.TaskpaneButton.Label" />
62+
<Description resid="Contoso.TaskpaneButton.Tooltip" />
63+
</Supertip>
64+
<Icon>
65+
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
66+
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
67+
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
68+
</Icon>
69+
<Action xsi:type="ShowTaskpane">
70+
<TaskpaneId>ButtonId1</TaskpaneId>
71+
<SourceLocation resid="Contoso.Taskpane.Url" />
72+
</Action>
73+
</Control>
74+
</Group>
75+
</OfficeTab>
76+
</ExtensionPoint>
77+
</DesktopFormFactor>
4278
</Host>
4379
</Hosts>
4480
<Resources>
@@ -51,11 +87,20 @@
5187
<bt:Url id="Contoso.Functions.Script.Url" DefaultValue="https://localhost:3000/dist/functions.js" />
5288
<bt:Url id="Contoso.Functions.Metadata.Url" DefaultValue="https://localhost:3000/dist/functions.json" />
5389
<bt:Url id="Contoso.Functions.Page.Url" DefaultValue="https://localhost:3000/dist/functions.html" />
90+
<bt:Url id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
91+
<bt:Url id="Contoso.Ribbon.Url" DefaultValue="https://localhost:3000/ribbon.html" />
5492
<bt:Url id="Contoso.Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html" />
5593
</bt:Urls>
5694
<bt:ShortStrings>
5795
<bt:String id="Contoso.Functions.Namespace" DefaultValue="CONTOSO" />
96+
<bt:String id="Contoso.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
97+
<bt:String id="Contoso.Group1Label" DefaultValue="Commands Group" />
98+
<bt:String id="Contoso.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
5899
</bt:ShortStrings>
100+
<bt:LongStrings>
101+
<bt:String id="Contoso.GetStarted.Description" DefaultValue="Your sample add-in loaded succesfully. Go to the HOME tab and click the 'Show Taskpane' button to get started." />
102+
<bt:String id="Contoso.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
103+
</bt:LongStrings>
59104
</Resources>
60105
</VersionOverrides>
61106
</OfficeApp>

src/ribbon/ribbon.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license in root of repo. -->
2+
3+
<!DOCTYPE html>
4+
<html>
5+
6+
<head>
7+
<meta charset="UTF-8" />
8+
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
9+
10+
<!-- Office JavaScript API -->
11+
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
12+
</head>
13+
14+
<body>
15+
16+
</body>
17+
18+
</html>

src/ribbon/ribbon.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3+
* See LICENSE in the project root for license information.
4+
*/
5+
6+
(() => {
7+
// The initialize function must be run each time a new page is loaded
8+
Office.initialize = () => {
9+
10+
};
11+
12+
// Add any ui-less function here
13+
})();

webpack.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ module.exports = (env, options) => {
99
const config = {
1010
devtool: "source-map",
1111
entry: {
12-
functions: "./src/functions/functions.ts",
13-
taskpane: "./src/taskpane/taskpane.ts"
12+
functions: "./src/functions/functions.ts",
13+
taskpane: "./src/taskpane/taskpane.ts",
14+
ribbon: "./src/ribbon/ribbon.ts"
1415
},
1516
resolve: {
1617
extensions: [".ts", ".tsx", ".html", ".js"]
@@ -51,6 +52,11 @@ module.exports = (env, options) => {
5152
template: "./src/taskpane/taskpane.html",
5253
chunks: ["taskpane"]
5354
}),
55+
new HtmlWebpackPlugin({
56+
filename: "ribbon.html",
57+
template: "./src/ribbon/ribbon.html",
58+
chunks: ["ribbon"]
59+
}),
5460
new webpack.ProvidePlugin({
5561
Promise: ["es6-promise", "Promise"]
5662
})

0 commit comments

Comments
 (0)