I started a new MS outlook plugin as described in their advanced tutorial. Now I want to add framework7 library. I installed via npm and referenced it correctly. So my starting html now correctly loads the framework.
Now I want to define routes to other html pages that will replace the current one as it is by framework7 policy, but I can not find a way to navigate to another page in the outlook plugin. Is this even possible?
Example from plugin index.html:
...
About app
...
and in index.js
$(document).ready(() => {
var app = new Framework7({
root: '#app',
name: 'My App',
id: 'com.myapp.test',
panel: {
swipe: 'left',
},
routes: [
{
path: '/about/',
url: 'about.html',
}
]
});
Is it possible to navigate to another html in the same plugin container?
Related
I use sandbox pages in my extension to render a Vue.js app to have a less strict CSP rules than a non-sandboxed extension pages.
All works great except I can't find way how to communicate with the background service worker. chrome APIs are not available in the sandbox context so I can't use them directly the same way I use it in the content scripts.
I also tried injecting a content script with message event listener to all pages and communicate with the background script via it (using postMessage on the page side and chrome.runtime.sendMessage on the content script side), but the content script is injected everywhere except my sandboxed extension page.
manifest.ts
const manifest = (): chrome.runtime.Manifest => ({
...
manifest_version: 3,
...
background: {
service_worker: 'src/background/background.js',
type: 'module',
},
...
...
sandbox: {
pages: ['web/index.html'],
},
content_scripts: [
// injected everywhere, but not to the sandboxed page ^^^
{
matches: ['<all_urls>'],
js: ['src/content-scripts/inject.js'],
run_at: 'document_start',
}
],
});
export default manifest;
chrome.runtime API is not available in the sandbox page context
How to get a dropdown selection for all available projects to user in BIM 360 Viewer forge application, NodeJS application.
You can use the Forge SDK in your server-side Node.js application to get a list of all projects for a specific BIM 360 "hub" using this endpoint: https://forge.autodesk.com/en/docs/data/v2/reference/http/hubs-hub_id-projects-GET. The Node.js code could look something like this: https://github.com/petrbroz/forge-hubs-browser-nodejs/blob/develop/services/forge.js#L64-L67. Then, your client-side JavaScript can fetch this list of projects, and populate a <select> element with them.
Alternatively, you could also retrieve the list of projects directly from the client. That's what I'm doing in this demo app: https://forgeextraderivatives.z6.web.core.windows.net. I'm adding the following script to my HTML:
<script src="https://cdn.jsdelivr.net/npm/forge-server-utils/dist/browser/forge-server-utils.js"></script>
And then, after obtaining an access token from the server-side, I do the following:
const bim360Client = new forge.BIM360Client({ token: '...' });
async function updateProjectsDropdown() {
const $projects = $('#projects');
$projects.empty();
const projects = await bim360Client.listProjects($('#hubs').val());
for (const project of projects) {
$projects.append(`<option value="${project.id}">${project.name}</option>`);
}
}
I am using swagger-ui-express and swagger-jsdoc for API Documentation of my node app. The point here is that I have two versions of API in my App and I want to document both of them. I have seen that in .NET Core there is an option available to define the specs and choose one from a dropdown in top bar. I am looking for a similar solution
As a dropdown can be seen in top bar I want similar via swagger-ui-express. Is it possible or if anybody has implemented the same for API Versioning?
Looking forward to your responses.
The solution I propose is not specific to API versioning, but you can have a dropdown of URLs the end-user can choose from. According to the docs, you would need to pass a swaggerOptions object:
const swaggerOptions = {
explorer: true,
swaggerOptions: {
urls: [
{
url: 'https://v1/swagger.json',
name: 'v1'
},
{
url: 'https://v2/swagger.json',
name: 'v2'
}
]
}
}
I like to redirect a page(e.g. login page) to another plugin using the deeplink url? Like for example during login, I want to redirect the user to the other page using the deeplink that is setup in the Control.
Like:
window.location.replace('deeplink url')
I am using the buildfire navigateTo, but don't know how to get the pluginId and instanceId, since it is not provided in the marketplace or in the myplugins section, there is not way to get it manually.
Here is my code:
buildfire.navigation.navigateTo({
pluginId: '',
instanceId: '',
title: 'Dashboard',
folderName: 'Dashboard',
});
How to get the pluginId or InstanceId of a certain plugin?
Is pluginId or instanceId is the license key of a custom plugin?
Do I need to use pluginInstance to set the plugin data and pass it to the navigateTo?
I have a Firefox OS app where I want a link to open outside of the application (the link is to a different site, and opening it in-application would make the application unusable without a force-quite). How do I do that?
Related bug report
If you don't want to change all the links in the application, you can use WebActivities, e.g. like this:
/*
* Open all external links in the browser
*/
$('a[href^=http]').click(function(e){
e.preventDefault();
var activity = new MozActivity({
name: "view",
data: {
type: "url",
url: $(this).attr("href")
}
});
});
Use target="_blank" on the <a> tag:
<a href='http://different.site/' target='_blank'>Different site</a>
Actually, if you send an app with external links without it to the Marketplace, it should be rejected. so watch out :)