omim - fix editor init error

This commit is contained in:
dntzhang 2019-06-12 15:51:36 +08:00
parent 3e1f66cb90
commit 52bb8a8ec1
3 changed files with 10 additions and 6 deletions

View File

@ -219,7 +219,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"./node_modules/_omi@6.6.2@omi/dist/omi.esm.js\");\nvar css = __webpack_require__(/*! quill/dist/quill.snow.css */ \"./node_modules/_quill@1.3.6@quill/dist/quill.snow.css\");\nvar Quill = __webpack_require__(/*! quill */ \"./node_modules/_quill@1.3.6@quill/dist/quill.js\");\n//@ts-ignore\n__webpack_require__(/*! ../theme.ts */ \"./src/theme.ts\");\nvar Editor = /** @class */ (function (_super) {\n __extends(Editor, _super);\n function Editor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Editor.prototype.installed = function () {\n var editor = new Quill(this.shadowRoot.querySelector('#editor'), {\n modules: { toolbar: this.shadowRoot.querySelector('#toolbar') },\n theme: 'snow'\n });\n };\n Editor.prototype.render = function (props) {\n return (omi_1.h(\"div\", null,\n omi_1.h(\"div\", { id: \"toolbar\" },\n omi_1.h(\"button\", { class: \"ql-bold\" }, \"Bold\"),\n omi_1.h(\"button\", { class: \"ql-italic\" }, \"Italic\")),\n omi_1.h(\"div\", { id: \"editor\" },\n omi_1.h(\"p\", null, \"Hello World!\"))));\n };\n Editor.css = css;\n Editor.propTypes = {};\n Editor = __decorate([\n omi_1.tag('m-editor')\n ], Editor);\n return Editor;\n}(omi_1.WeElement));\nexports.default = Editor;\n\n\n//# sourceURL=webpack:///./src/editor/index.tsx?");
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"./node_modules/_omi@6.6.2@omi/dist/omi.esm.js\");\nvar css = __webpack_require__(/*! quill/dist/quill.snow.css */ \"./node_modules/_quill@1.3.6@quill/dist/quill.snow.css\");\nvar Quill = __webpack_require__(/*! quill */ \"./node_modules/_quill@1.3.6@quill/dist/quill.js\");\n//@ts-ignore\n__webpack_require__(/*! ../theme.ts */ \"./src/theme.ts\");\nvar style = document.createElement('style');\nstyle.textContent = css;\ndocument.querySelector('head').appendChild(style);\nvar Editor = /** @class */ (function (_super) {\n __extends(Editor, _super);\n function Editor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Editor.prototype.installed = function () {\n document.body.appendChild(this.shadowRoot.querySelector('div'));\n var editor = new Quill('#editor', {\n modules: { toolbar: '#toolbar' },\n theme: 'snow'\n });\n };\n Editor.prototype.render = function (props) {\n return (omi_1.h(\"div\", null,\n omi_1.h(\"div\", { id: \"toolbar\" },\n omi_1.h(\"button\", { class: \"ql-bold\" }, \"Bold\"),\n omi_1.h(\"button\", { class: \"ql-italic\" }, \"Italic\")),\n omi_1.h(\"div\", { id: \"editor\" },\n omi_1.h(\"p\", null, \"Hello World!\"))));\n };\n Editor.css = css;\n Editor.propTypes = {};\n Editor = __decorate([\n omi_1.tag('m-editor')\n ], Editor);\n return Editor;\n}(omi_1.WeElement));\nexports.default = Editor;\n\n\n//# sourceURL=webpack:///./src/editor/index.tsx?");
/***/ }),

View File

@ -130,6 +130,7 @@
"draggabilly": "^2.2.0",
"moment": "^2.24.0",
"progressbar.js": "^1.0.1",
"quill": "^1.3.6",
"to2to": "^1.0.2"
}
}

View File

@ -4,6 +4,10 @@ import * as Quill from 'quill'
//@ts-ignore
import '../theme.ts'
const style = document.createElement('style')
style.textContent = css
document.querySelector('head').appendChild(style)
interface Props {
}
@ -19,17 +23,16 @@ export default class Editor extends WeElement<Props, Data> {
installed() {
var editor = new Quill(this.shadowRoot.querySelector('#editor'), {
modules: { toolbar: this.shadowRoot.querySelector('#toolbar') },
document.body.appendChild(this.shadowRoot.querySelector('div'))
const editor = new Quill('#editor', {
modules: { toolbar: '#toolbar' },
theme: 'snow'
});
})
}
render(props) {
return (
<div>
<div id="toolbar">
<button class="ql-bold">Bold</button>
<button class="ql-italic">Italic</button>