@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
24 lines • 958 B
JavaScript
import { DOMParser, } from '../../prosemirror';
import { MarkdownSerializer, marks, nodes, } from './serializer';
import { bitbucketSchema } from '../../schema';
import { transformHtml } from './util';
var BitbucketTransformer = (function () {
function BitbucketTransformer(schema) {
if (schema === void 0) { schema = bitbucketSchema; }
this.serializer = new MarkdownSerializer(nodes, marks);
this.schema = schema;
}
BitbucketTransformer.prototype.encode = function (node) {
return this.serializer.serialize(node);
};
BitbucketTransformer.prototype.parse = function (html) {
var dom = this.buildDOMTree(html);
return DOMParser.fromSchema(this.schema).parse(dom);
};
BitbucketTransformer.prototype.buildDOMTree = function (html) {
return transformHtml(html);
};
return BitbucketTransformer;
}());
export default BitbucketTransformer;
//# sourceMappingURL=index.js.map