oak-general-business/lib/pages/article/preview/index.js

45 lines
1.4 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
isList: false,
formData: function (_a) {
var features = _a.features;
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_b) {
return [2 /*return*/, {}];
});
});
},
listeners: {
content: function (prev, next) {
if (prev.content !== next.content) {
var ac = window.document.getElementById('article-content');
if (ac) {
ac.innerHTML = next.content;
}
}
},
},
data: {
content: '',
title: '',
author: '',
},
lifetimes: {
attached: function () {
var data = this.load('article_html') || '{}';
var data2 = typeof data === 'string' ? JSON.parse(data) : data;
this.setState({
content: data2 === null || data2 === void 0 ? void 0 : data2.content,
title: data2 === null || data2 === void 0 ? void 0 : data2.title,
author: data2 === null || data2 === void 0 ? void 0 : data2.author,
});
},
detached: function () {
this.save('article_html', '{}');
},
},
methods: {},
});