mirror of
https://github.com/zadam/trilium.git
synced 2024-09-20 23:55:59 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
76aa7d1451
|
@ -34,9 +34,7 @@ class AppContext extends Component {
|
|||
|
||||
this.tabManager.loadTabs();
|
||||
|
||||
if (utils.isDesktop()) {
|
||||
setTimeout(() => bundleService.executeStartupBundles(), 2000);
|
||||
}
|
||||
setTimeout(() => bundleService.executeStartupBundles(), 2000);
|
||||
}
|
||||
|
||||
showWidgets() {
|
||||
|
|
|
@ -2,6 +2,7 @@ import ScriptContext from "./script_context.js";
|
|||
import server from "./server.js";
|
||||
import toastService from "./toast.js";
|
||||
import treeCache from "./tree_cache.js";
|
||||
import utils from "./utils.js";
|
||||
|
||||
async function getAndExecuteBundle(noteId, originEntity = null) {
|
||||
const bundle = await server.get('script/bundle/' + noteId);
|
||||
|
@ -25,7 +26,8 @@ async function executeBundle(bundle, originEntity, $container) {
|
|||
}
|
||||
|
||||
async function executeStartupBundles() {
|
||||
const scriptBundles = await server.get("script/startup");
|
||||
const isMobile = utils.isMobile();
|
||||
const scriptBundles = await server.get("script/startup" + (isMobile ? "?mobile=true" : ""));
|
||||
|
||||
for (const bundle of scriptBundles) {
|
||||
await executeBundle(bundle);
|
||||
|
|
|
@ -104,9 +104,18 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
|||
this.addButtonToToolbar = opts => {
|
||||
const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-");
|
||||
|
||||
const button = $('<button class="noborder">')
|
||||
.addClass("btn btn-sm")
|
||||
.on('click', opts.action);
|
||||
let button;
|
||||
if (utils.isMobile()) {
|
||||
$('#plugin-buttons-placeholder').remove();
|
||||
button = $('<a class="dropdown-item" href="#">')
|
||||
.on('click', () => {
|
||||
setTimeout(() => $pluginButtons.dropdown('hide'), 0);
|
||||
});
|
||||
} else {
|
||||
button = $('<button class="noborder">')
|
||||
.addClass("btn btn-sm");
|
||||
}
|
||||
button = button.on('click', opts.action);
|
||||
|
||||
if (opts.icon) {
|
||||
button.append($("<span>").addClass("bx bx-" + opts.icon))
|
||||
|
|
|
@ -13,6 +13,11 @@ const WIDGET_TPL = `
|
|||
top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#plugin-buttons-placeholder {
|
||||
font-size: smaller;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<a data-trigger-command="createNoteIntoInbox" title="New note" class="icon-action bx bx-folder-plus"></a>
|
||||
|
@ -21,6 +26,14 @@ const WIDGET_TPL = `
|
|||
|
||||
<a data-trigger-command="scrollToActiveNote" title="Scroll to active note" class="icon-action bx bx-crosshair"></a>
|
||||
|
||||
<div class="dropdown">
|
||||
<a title="Plugin buttons" class="icon-action bx bx-extension dropdown-toggle" data-toggle="dropdown"></a>
|
||||
|
||||
<div id="plugin-buttons" class="dropdown-menu dropdown-menu-right">
|
||||
<p id="plugin-buttons-placeholder">No plugin buttons loaded yet.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<a title="Global actions" class="icon-action bx bx-cog dropdown-toggle" data-toggle="dropdown"></a>
|
||||
|
||||
|
|
|
@ -53,9 +53,14 @@ function getBundlesWithLabel(label, value) {
|
|||
return bundles;
|
||||
}
|
||||
|
||||
function getStartupBundles() {
|
||||
function getStartupBundles(req) {
|
||||
if (!process.env.TRILIUM_SAFE_MODE) {
|
||||
return getBundlesWithLabel("run", "frontendStartup");
|
||||
if (req.query.mobile === "true") {
|
||||
return getBundlesWithLabel("run", "mobileStartup");
|
||||
}
|
||||
else {
|
||||
return getBundlesWithLabel("run", "frontendStartup");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
|
|
Loading…
Reference in a new issue