FEATURE: Expose `Composer.serializeToTopic` in client side plugin api.

This commit is contained in:
Guo Xiang Tan 2020-05-15 16:16:58 +08:00
parent 858735b5da
commit f9a9bd136b
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 16 additions and 1 deletions

View File

@ -55,7 +55,7 @@ import { on } from "@ember/object/evented";
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
// If you add any methods to the API ensure you bump up this number
const PLUGIN_API_VERSION = "0.9.0";
const PLUGIN_API_VERSION = "0.10.0";
class PluginApi {
constructor(version, container) {
@ -941,6 +941,21 @@ class PluginApi {
Composer.reopen({ beforeSave: method });
}
/**
* Adds a field to topic edit serializer
*
* Example:
*
* api.serializeToTopic('key_set_in_model', 'field_name_in_payload');
*
* to keep both of them same
* api.serializeToTopic('field_name');
*
*/
serializeToTopic(fieldName, property) {
Composer.serializeToTopic(fieldName, property);
}
/**
* Adds a field to draft serializer
*