[Feature Request]: [wysiwyg] Button to browse for code reuse insertion #2668

Closed
opened 2026-02-05 04:45:16 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @robertfshort on GitHub (Feb 24, 2022).

Describe the feature you'd like

it would be helpful is there was a button to insert a 'code reuse' similarly to how the insert link browse functionality works.

Describe the benefits this feature would bring to BookStack users

  • quick insert of other pages for code reuse
  • helps less technical users reuse other pages

Additional context

No response

Originally created by @robertfshort on GitHub (Feb 24, 2022). ### Describe the feature you'd like it would be helpful is there was a button to insert a 'code reuse' similarly to how the insert link browse functionality works. ### Describe the benefits this feature would bring to BookStack users - quick insert of other pages for code reuse - helps less technical users reuse other pages ### Additional context _No response_
OVERLORD added the 🔨 Feature Request label 2026-02-05 04:45:16 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Feb 24, 2022):

Hi @robertfshort,
By 'code reuse' are you referring to the inlcude tags? For example {{@5}}?

If so, this functionality is only really intended for advanced users since non-technical users may not be aware of the caveats of such as system (Permission system interference, lack of indexing of included content, potential brittleness upon original content edits.) I'm generally happy with the level of support we provided the advanced users that this system is intended for.

@ssddanbrown commented on GitHub (Feb 24, 2022): Hi @robertfshort, By 'code reuse' are you referring to the inlcude tags? For example `{{@5}}`? If so, this functionality is only really intended for advanced users since non-technical users may not be aware of the caveats of such as system (Permission system interference, lack of indexing of included content, potential brittleness upon original content edits.) I'm generally happy with the level of support we provided the advanced users that this system is intended for.
Author
Owner

@robertfshort commented on GitHub (Feb 25, 2022):

Yes the include tags. I'm a pretty technical user that's just starting to play around and evaluate if bookstacks could be something useful. I would likely have a huge number of inclusions, nested if that ever gets rolled into the product as some of my prior work on other products have heavily used this feature. Right now, it's a pain in the butt to go find the number to use.

For non-technical users, having a button would advertise that this capability exists. I know I'd be using it as a selling point when I'm training people, since having a private book where some pages are custom set to public, and then a public book of pages that just include the private pages is how I was planning on having things rolled out.

@robertfshort commented on GitHub (Feb 25, 2022): Yes the include tags. I'm a pretty technical user that's just starting to play around and evaluate if bookstacks could be something useful. I would likely have a huge number of inclusions, nested if that ever gets rolled into the product as some of my prior work on other products have heavily used this feature. Right now, it's a pain in the butt to go find the number to use. For non-technical users, having a button would advertise that this capability exists. I know I'd be using it as a selling point when I'm training people, since having a private book where some pages are custom set to public, and then a public book of pages that just include the private pages is how I was planning on having things rolled out.
Author
Owner

@ssddanbrown commented on GitHub (Feb 25, 2022):

and then a public book of pages that just include the private pages is how I was planning on having things rolled out.

You should be aware that the included content of those included private pages won't be visible if the viewer does not have permission to see the original page that content is taken from.

For non-technical users, having a button would advertise that this capability exists.

I still feel I don't want to advertise this to non-technical users, due to the caveats mentioned in my previous comment.

If this is primarily for your own usage, I could likely come up with an unofficial "Custom HTML Head Content" script that would achieve this. Would that help you?

@ssddanbrown commented on GitHub (Feb 25, 2022): > and then a public book of pages that just include the private pages is how I was planning on having things rolled out. You should be aware that the included content of those included private pages won't be visible if the viewer does not have permission to see the original page that content is taken from. > For non-technical users, having a button would advertise that this capability exists. I still feel I don't want to advertise this to non-technical users, due to the caveats mentioned in my previous comment. If this is primarily for your own usage, I could likely come up with an unofficial "Custom HTML Head Content" script that would achieve this. Would that help you?
Author
Owner

@ssddanbrown commented on GitHub (Mar 2, 2022):

I'm going to go ahead and close this off but the below should allow a picker interface, for include tags, via a Ctrl+L or Cmd+L shortcut in the editor. Just be sure to only select pages, not chapters/books, for inclusion.

<script>
window.addEventListener('editor-tinymce::setup', event => {
	const editor = event.detail.editor;
	editor.addShortcut('meta+l', '', function() {
		window.EntitySelectorPopup.show(page => {
		   editor.insertContent(`{{@${page.id}}}`);
		})
	});
});
</script>

Just need to add that to the "Custom HTML Head Content" setting. Could potentially break upon future updates.

@ssddanbrown commented on GitHub (Mar 2, 2022): I'm going to go ahead and close this off but the below should allow a picker interface, for include tags, via a `Ctrl+L` or `Cmd+L` shortcut in the editor. Just be sure to only select pages, not chapters/books, for inclusion. ```html <script> window.addEventListener('editor-tinymce::setup', event => { const editor = event.detail.editor; editor.addShortcut('meta+l', '', function() { window.EntitySelectorPopup.show(page => { editor.insertContent(`{{@${page.id}}}`); }) }); }); </script> ``` Just need to add that to the "Custom HTML Head Content" setting. Could potentially break upon future updates.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2668