UNPKG

1.76 kBJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @legacyServerCallableInstance
8 * @format
9 *
10 * @emails oncall+draft_js
11 */
12'use strict';
13
14function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
15
16var Immutable = require("immutable");
17
18var Record = Immutable.Record;
19var DraftEntityInstanceRecord = Record({
20 type: 'TOKEN',
21 mutability: 'IMMUTABLE',
22 data: Object
23});
24/**
25 * An instance of a document entity, consisting of a `type` and relevant
26 * `data`, metadata about the entity.
27 *
28 * For instance, a "link" entity might provide a URI, and a "mention"
29 * entity might provide the mentioned user's ID. These pieces of data
30 * may be used when rendering the entity as part of a ContentBlock DOM
31 * representation. For a link, the data would be used as an href for
32 * the rendered anchor. For a mention, the ID could be used to retrieve
33 * a hovercard.
34 */
35
36var DraftEntityInstance = /*#__PURE__*/function (_DraftEntityInstanceR) {
37 _inheritsLoose(DraftEntityInstance, _DraftEntityInstanceR);
38
39 function DraftEntityInstance() {
40 return _DraftEntityInstanceR.apply(this, arguments) || this;
41 }
42
43 var _proto = DraftEntityInstance.prototype;
44
45 _proto.getType = function getType() {
46 return this.get('type');
47 };
48
49 _proto.getMutability = function getMutability() {
50 return this.get('mutability');
51 };
52
53 _proto.getData = function getData() {
54 return this.get('data');
55 };
56
57 return DraftEntityInstance;
58}(DraftEntityInstanceRecord);
59
60module.exports = DraftEntityInstance;
\No newline at end of file