So, for me the idea of Quick Parts is to have some reusable content that you can paste wherever you want (in the wiki editor or WYSIWYG editor). I see it as some content written in a given syntax and that when pasted is converted to the target syntax of where it’s pasted.
Let’s see what we have already that is the closest to this:
Wiki macros
Difference: harder to create and generic. They’re not instantiated with parameter values and content value.
Document Template
Difference: The scope is not the same, document templates are full-fledged documents and not document parts
Difference: currently not usable from within an XWiki instance.
Note: I’ve always wanted to create a snippets app that would connect to snippets.xwiki.org and list snippets inside of XWiki so that you could insert them + other features (ability to save/upload new snippets). We could imagine the ability to create new snippets locally without uploading them and thus acting as personal snippets or even shared between groups/users. If this extension was adding some editor buttons to insert a snippet + the ability to select some content when viewing or editing a page to save it as a snippet (I guess this is the hardest part), then it could fit the bill. Especially if the extension was configurable so that it wouldn’t check snippets.xwiki.org (for the cases where you don’t want to allow your XWiki instance to connect to some external site).
I don’t remember the name but we used to have an extension to copy web content and paste it inside of XWiki at some point (nothing official and it could just have been a POC developed by XWiki SAS for some client).
Others:
I guess there are also existing Browser extensions to implement this.
Difference: probably personal only and no ability to share between users/groups of a XWiki instance + no tight integration in XWiki (with a toolbar entry in the WYSIWYG editor for example)
So 2 questions:
Do you think this would be a useful feature?
WDYT of the analysis above?
Thanks
PS: I have no plan to implement anything, this is just so that we discuss it to know more about our interest (or non-interest) for the feature, and have a place to come back too in the future if the need surfaces.
Maybe we should focus on making the experience of creating a macro simpler?
Having a wizard like AWM for macros, in addition to an integration of those custom macros in the editors UI, would make it way more usable by non technical users.
EDIT: We could also just say that non tech users do not need wiki macros
AFAIU you can create a macro with default values for another macro, that would allow to instantiate a macro with parameter value and content value. It’s technically a bit different, but we could provide a UI that would create for you the prefilledMacro.
This is all just throwing ideas at the wall though and technically I reckon this prefilledMacro idea would come with a lot of difficulties ^^’
+1, I think that’s a very interesting feature. Basically similar to the include macro, but instead of including the content, it is copied into the page. In many cases, having a proper page created from a page template or having a wiki macro could be a better solution, but I think this feature could offer an easier way for less technical users to achieve similar results. And in some cases it might also indeed be the “correct” solution.
I imagine this also to be useful for content like checklists for certain tasks, “composable” templates where instead of having one big template you just add the parts you need, … These are not really use cases for wiki macros in my opinion.
What would indeed be an interesting feature that is currently missing for wiki macros is to be able to have a default content. That feature is currently only available for Java macros afaik. We could also make it easier to create wiki macros, but this should be separate from this feature in my opinion - and it won’t really be easy. On the other hand, this quick parts feature could be relatively easy to build.
I guess the implementation depends a lot on whether we want those quick parts to be impacted by a modification of the source or not. i.e. do we want a copy (like templates or code snippets) or an include (like wiki macros).
For copy maybe what we need is to make the concept of template a bit more generic since in the end it’s basically the same thing but for a piece of content instead of a whole page.
My understanding was that this is explicitly about having a copy as otherwise you can already have this with the include/display macros.
What we shouldn’t forget is the security aspect. If the quick part’s author doesn’t have script right but includes a script macro and the quick part is then inserted by a user with script right, the script macro will be executed. We could use the required rights analyzer to detect this situation, though, and to warn the user before inserting the quick part. Unfortunately, I fear that required rights won’t significantly improve this situation as when the required rights of the quick part and the current document are different, you’re in the same situation as before (a quick part without required script right could still contain a script macro that will be executed after inserting it into a document with a script required right).
Both @vmassol and @CharpentierLucas mentioned and discussed the good and bad of using wiki macros (which are an include system too) to cover this need, so I preferred making sure what was the end goal on this aspect.
have a small XWiki application to define reusable content snippets / templates (the snippet would be stored in the page content and the page title would serve as a label for the snippet; additionally we may need a small description)
have a CKEditor plugin that:
either simply puts a drop down on the toolbar to list the available snippets (by their label); inserting the selected snippet is just a matter of executing a CKEditor command (insertHTML)
or (with more work) puts a button on the toolbar that opens a modal to select the snippet; the modal would allow the user to search / filter the snippet (e.g. by category) and to maybe also preview them