forked from Gitlink/forgeplus-react
70 lines
2.6 KiB
JavaScript
70 lines
2.6 KiB
JavaScript
/**
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule DraftEntityInstance
|
|
* @legacyServerCallableInstance
|
|
* @format
|
|
*
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var Immutable = require('immutable');
|
|
|
|
var Record = Immutable.Record;
|
|
|
|
|
|
var DraftEntityInstanceRecord = Record({
|
|
type: 'TOKEN',
|
|
mutability: 'IMMUTABLE',
|
|
data: Object
|
|
});
|
|
|
|
/**
|
|
* An instance of a document entity, consisting of a `type` and relevant
|
|
* `data`, metadata about the entity.
|
|
*
|
|
* For instance, a "link" entity might provide a URI, and a "mention"
|
|
* entity might provide the mentioned user's ID. These pieces of data
|
|
* may be used when rendering the entity as part of a ContentBlock DOM
|
|
* representation. For a link, the data would be used as an href for
|
|
* the rendered anchor. For a mention, the ID could be used to retrieve
|
|
* a hovercard.
|
|
*/
|
|
|
|
var DraftEntityInstance = function (_DraftEntityInstanceR) {
|
|
_inherits(DraftEntityInstance, _DraftEntityInstanceR);
|
|
|
|
function DraftEntityInstance() {
|
|
_classCallCheck(this, DraftEntityInstance);
|
|
|
|
return _possibleConstructorReturn(this, _DraftEntityInstanceR.apply(this, arguments));
|
|
}
|
|
|
|
DraftEntityInstance.prototype.getType = function getType() {
|
|
return this.get('type');
|
|
};
|
|
|
|
DraftEntityInstance.prototype.getMutability = function getMutability() {
|
|
return this.get('mutability');
|
|
};
|
|
|
|
DraftEntityInstance.prototype.getData = function getData() {
|
|
return this.get('data');
|
|
};
|
|
|
|
return DraftEntityInstance;
|
|
}(DraftEntityInstanceRecord);
|
|
|
|
module.exports = DraftEntityInstance; |