diff --git a/static/main.js b/static/main.js index c4b92c1b7..4766a84fb 100644 --- a/static/main.js +++ b/static/main.js @@ -277,8 +277,6 @@ function start() { var root = $("#root"); - var hideEditorToolbar = config.hideEditorToolbar; - var layout; var hub; try { @@ -384,7 +382,7 @@ function start() { $('#version-tree').prop('href', versionLink); } - if (options.embedded && hideEditorToolbar === "true") { + if (options.hideEditorToolbars) { $('[name="editor-btn-toolbar"]').addClass("d-none"); } diff --git a/static/sharing.js b/static/sharing.js index 21b67f1ad..4cd0606e8 100644 --- a/static/sharing.js +++ b/static/sharing.js @@ -224,14 +224,32 @@ function initShareButton(getLink, layout, noteNewState) { } } -function getEmbeddedUrl(config, root, readOnly) { +function getEmbeddedUrl(config, root, readOnly, extraOptions) { var location = window.location.origin + root; - var path = readOnly ? 'embed-ro#' : 'e#'; + var path = ""; + var parameters = ""; + + _.forEach(extraOptions, (value, key) => { + if (parameters === "") { + parameters = "?"; + } else { + parameters += "&"; + } + + parameters += key + "=" + value; + }); + + if (readOnly) { + path = 'embed-ro' + parameters + '#'; + } else { + path = 'e' + parameters + '#'; + } + return location + path + url.serialiseState(config); } -function getEmbeddedHtml(config, root, isReadOnly) { - return ''; +function getEmbeddedHtml(config, root, isReadOnly, extraOptions) { + return ''; } function getShortLink(config, root, done) { @@ -276,6 +294,12 @@ function getLinks(config, currentBind, done) { case 'Embed (RO)': done(null, getEmbeddedHtml(config, root, readOnly), false); return; + case 'Embed (hide Tb)': + var options = { + "hideEditorToolbars": true + }; + done(null, getEmbeddedHtml(config, root, false, options), false); + return; default: // Hmmm done('Unknown link type', null); diff --git a/views/templates.pug b/views/templates.pug index 8115f6b73..f4aa3995a 100644 --- a/views/templates.pug +++ b/views/templates.pug @@ -18,6 +18,8 @@ | Embed button.dropdown-item.btn.btn-light.btn-sm(data-bind="Embed (RO)") | Embed (read only) + button.dropdown-item.btn.btn-light.btn-sm(data-bind="Embed (hide Tb)") + | Embed (hidden toolbars) input.form-control.input-sm.permalink(type="text" placeholder="Loading" readonly size="1024" style="font-size: 10px") .input-group-append button.input-group-btn.btn.btn-outline-secondary.btn-sm.clippy(type="button" data-clipboard-target=".popover .permalink" title="Copy to clipboard")