[IMP] knowledge: add the template and file commands

This commit adds some commands that can be used in the html editor.

Editor Commands
---------------

Some new editor commands have been added:

- */article:*
This command is available on every html field using the Odoo Editor.
This command allows to add a direct link to the selected knowledge article.

- */file:*
This command is only available in the Knowledge App.
This command allows to add a file (or an image) download button inside the
body. The user can choose a file to add from its own file directory or an
existing attachment already present in the database.

- */template:*
This command is only available in the Knowledge App.
This command allows the user to create a block where them can write and lay out
content destined to be reused by the readers of the article. The lasts will be
able to copy and paste it to send it as message or use it as a description on
other records.
No /command can be added inside a template.

Technical notes:
/file and /template commands can be activated in other modules by adding
knowledge_commands = True on the html field in the view where they should
be activated.

Task-2674460

Part-of: odoo/odoo#82315
Co-authored-by: Damien Abeloos <abd@odoo.com>
Co-authored-by: Julien Banken <jbn@odoo.com>
Co-authored-by: David Beguin <dbe@odoo.com>
Co-authored-by: Fabio Barbero <faba@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
Co-authored-by: Aurelien Warnong <awa@odoo.com>
This commit is contained in:
abd-msyukyu-odoo
2022-05-13 02:58:51 +02:00
committed by David Beguin
co-authored by Julien Banken David Beguin Fabio Barbero Thibault Delavallee Aurelien Warnong
parent 0727bbe8f1
commit 3cd87ca0dc
26 changed files with 2096 additions and 85 deletions
@@ -28,7 +28,23 @@ const KnowledgeArticleFormController = FormController.extend({
emoji_click: '_onEmojiClick',
}),
/**
* Register the fact that the current @see FormController is one from
* Knowledge in order not to try and search for a matching record for
* @see KnowledgeService .
*
* @override
*/
init: function (parent, model, renderer, params) {
/**
* This property is used to specify that the current form view will
* get/use records stored in the @see KnowledgeService instead of
* replacing them (default). TODO ABD: maybe set this as an option of
* the form view (XML) so that other form views can easily specify that
* they will get/use records from the KnowledgeService instead of
* providing them.
*/
this.ignoreKnowledgeRecordSearch = true;
this.renderer = renderer;
this._super.apply(this, arguments);
this.onFieldSavedListeners = new Map();