UNPKG

vue3-quill

Version:
698 lines (559 loc) 22.2 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "fb15"); /******/ }) /************************************************************************/ /******/ ({ /***/ "0cfb": /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__("83ab"); var fails = __webpack_require__("d039"); var createElement = __webpack_require__("cc12"); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /***/ "14e1": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "6c81": /***/ (function(module, exports) { module.exports = require("quill"); /***/ }), /***/ "8096": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "825a": /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__("861d"); module.exports = function (it) { if (!isObject(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; /***/ }), /***/ "83ab": /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__("d039"); // Detect IE8's incomplete defineProperty implementation module.exports = !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); /***/ }), /***/ "861d": /***/ (function(module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /***/ "8875": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller // MIT license // source: https://github.com/amiller-gh/currentScript-polyfill // added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505 (function (root, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }(typeof self !== 'undefined' ? self : this, function () { function getCurrentScript () { var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript') // for chrome if (!descriptor && 'currentScript' in document && document.currentScript) { return document.currentScript } // for other browsers with native support for currentScript if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) { return document.currentScript } // IE 8-10 support script readyState // IE 11+ & Firefox support stack trace try { throw new Error(); } catch (err) { // Find the second match for the "at" string to get file src url from stack. var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig, ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig, stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack), scriptLocation = (stackDetails && stackDetails[1]) || false, line = (stackDetails && stackDetails[2]) || false, currentLocation = document.location.href.replace(document.location.hash, ''), pageSource, inlineScriptSourceRegExp, inlineScriptSource, scripts = document.getElementsByTagName('script'); // Live NodeList collection if (scriptLocation === currentLocation) { pageSource = document.documentElement.outerHTML; inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i'); inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim(); } for (var i = 0; i < scripts.length; i++) { // If ready state is interactive, return the script tag if (scripts[i].readyState === 'interactive') { return scripts[i]; } // If src matches, return the script tag if (scripts[i].src === scriptLocation) { return scripts[i]; } // If inline source matches, return the script tag if ( scriptLocation === currentLocation && scripts[i].innerHTML && scripts[i].innerHTML.trim() === inlineScriptSource ) { return scripts[i]; } } // If no match, return null return null; } }; return getCurrentScript })); /***/ }), /***/ "8bbf": /***/ (function(module, exports) { module.exports = require("vue"); /***/ }), /***/ "9bf2": /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__("83ab"); var IE8_DOM_DEFINE = __webpack_require__("0cfb"); var anObject = __webpack_require__("825a"); var toPrimitive = __webpack_require__("c04e"); // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /***/ "a753": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "b0c0": /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__("83ab"); var defineProperty = __webpack_require__("9bf2").f; var FunctionPrototype = Function.prototype; var FunctionPrototypeToString = FunctionPrototype.toString; var nameRE = /^\s*function ([^ (]*)/; var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name if (DESCRIPTORS && !(NAME in FunctionPrototype)) { defineProperty(FunctionPrototype, NAME, { configurable: true, get: function () { try { return FunctionPrototypeToString.call(this).match(nameRE)[1]; } catch (error) { return ''; } } }); } /***/ }), /***/ "c04e": /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__("861d"); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (input, PREFERRED_STRING) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /***/ "c8ba": /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /***/ "cc12": /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__("da84"); var isObject = __webpack_require__("861d"); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; /***/ }), /***/ "d039": /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; /***/ }), /***/ "da84": /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba"))) /***/ }), /***/ "fb15": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, "Quill", function() { return /* reexport */ external_root_Quill_commonjs_quill_commonjs2_quill_amd_quill_default.a; }); __webpack_require__.d(__webpack_exports__, "quillEditor", function() { return /* reexport */ src_editor; }); // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js // This file is imported into lib/wc client bundles. if (typeof window !== 'undefined') { var currentScript = window.document.currentScript if (true) { var getCurrentScript = __webpack_require__("8875") currentScript = getCurrentScript() // for backward compatibility, because previously we directly included the polyfill if (!('currentScript' in document)) { Object.defineProperty(document, 'currentScript', { get: getCurrentScript }) } } var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/) if (src) { __webpack_require__.p = src[1] // eslint-disable-line } } // Indicate to webpack that this file can be concatenated /* harmony default export */ var setPublicPath = (null); // EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js var es_function_name = __webpack_require__("b0c0"); // EXTERNAL MODULE: external {"root":"Quill","commonjs":"quill","commonjs2":"quill","amd":"quill"} var external_root_Quill_commonjs_quill_commonjs2_quill_amd_quill_ = __webpack_require__("6c81"); var external_root_Quill_commonjs_quill_commonjs2_quill_amd_quill_default = /*#__PURE__*/__webpack_require__.n(external_root_Quill_commonjs_quill_commonjs2_quill_amd_quill_); // EXTERNAL MODULE: external "vue" var external_vue_ = __webpack_require__("8bbf"); // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/editor.vue?vue&type=template&id=0f198ada var _hoisted_1 = { ref: "editor" }; function render(_ctx, _cache, $props, $setup, $data, $options) { return Object(external_vue_["openBlock"])(), Object(external_vue_["createBlock"])("section", _hoisted_1, null, 512); } // CONCATENATED MODULE: ./src/editor.vue?vue&type=template&id=0f198ada // EXTERNAL MODULE: ./node_modules/quill/dist/quill.core.css var quill_core = __webpack_require__("a753"); // EXTERNAL MODULE: ./node_modules/quill/dist/quill.snow.css var quill_snow = __webpack_require__("8096"); // EXTERNAL MODULE: ./node_modules/quill/dist/quill.bubble.css var quill_bubble = __webpack_require__("14e1"); // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/editor.vue?vue&type=script&lang=js var defaultOptions = { theme: 'snow', boundary: document.body, modules: { toolbar: [['bold', 'italic', 'underline', 'strike'], ['blockquote', 'code-block'], [{ header: 1 }, { header: 2 }], [{ list: 'ordered' }, { list: 'bullet' }], [{ script: 'sub' }, { script: 'super' }], [{ indent: '-1' }, { indent: '+1' }], [{ direction: 'rtl' }], [{ size: ['small', false, 'large', 'huge'] }], [{ header: [1, 2, 3, 4, 5, 6, false] }], [{ color: [] }, { background: [] }], [{ font: [] }], [{ align: [] }], ['clean'], ['link', 'image', 'video']] }, placeholder: 'Insert content here ...', readOnly: false }; /* harmony default export */ var editorvue_type_script_lang_js = ({ name: 'quill-editor', props: { content: String, value: String, disabled: { type: Boolean, default: false }, options: { type: Object, required: false, default: function _default() { return {}; } } }, emits: ['ready', 'change', 'input', 'blur', 'focus', 'update:value'], setup: function setup(props, context) { var state = { editorOption: {}, quill: null }; var _content = ''; Object(external_vue_["watch"])(function () { return props.value; }, function (val) { if (state.quill) { if (val && val !== _content) { _content = val; state.quill.pasteHTML(val); } else if (!val) { state.quill.setText(''); } } }); Object(external_vue_["watch"])(function () { return props.content; }, function (val) { if (state.quill) { if (val && val !== _content) { _content = val; state.quill.pasteHTML(val); } else if (!val) { state.quill.setText(''); } } }); Object(external_vue_["watch"])(function () { return props.disabled; }, function (val) { if (state.quill) { state.quill.enable(!val); } }); var editor = Object(external_vue_["ref"])(null); var mergeOptions = function mergeOptions(def, custom) { for (var key in custom) { if (!def[key] || key !== 'modules') { def[key] = custom[key]; } else { mergeOptions(def[key], custom[key]); } } return def; }; var initialize = function initialize() { if (editor.value) { // Options state.editorOption = mergeOptions(defaultOptions, props.options); // Instance state.quill = new external_root_Quill_commonjs_quill_commonjs2_quill_amd_quill_default.a(editor.value, state.editorOption); // console.log('intilized') // Set editor content if (props.value) { state.quill.pasteHTML(props.value); } // Mark model as touched if editor lost focus state.quill.on('selection-change', function (range) { if (!range) { context.emit('blur', state.quill); } else { context.emit('focus', state.quill); } }); // Update model if text changes state.quill.on('text-change', function () { // diabled editor after content initialized if (props.disabled) { state.quill.enable(false); } var html = editor.value.children[0].innerHTML; var quill = state.quill; var text = state.quill.getText(); if (html === '<p><br></p>') html = ''; _content = html; context.emit('update:value', _content); context.emit('change', { html: html, text: text, quill: quill }); }); // Emit ready event context.emit('ready', state.quill); } }; Object(external_vue_["onBeforeUnmount"])(function () { var editorToolbar = editor.value.previousSibling; if (editorToolbar && editorToolbar.className.indexOf('ql-toolbar') > -1) { editorToolbar.parentNode.removeChild(editorToolbar); } }); Object(external_vue_["onMounted"])(function () { initialize(); }); Object(external_vue_["onUnmounted"])(function () { state.quill = null; }); return { editor: editor }; } }); // CONCATENATED MODULE: ./src/editor.vue?vue&type=script&lang=js // CONCATENATED MODULE: ./src/editor.vue editorvue_type_script_lang_js.render = render /* harmony default export */ var src_editor = (editorvue_type_script_lang_js); // CONCATENATED MODULE: ./src/index.js src_editor.install = function (app) { app.component(src_editor.name, src_editor); }; var VueQuillEditor = { Quill: external_root_Quill_commonjs_quill_commonjs2_quill_amd_quill_default.a, quillEditor: src_editor }; /* harmony default export */ var src_0 = (VueQuillEditor); // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src_0); /***/ }) /******/ }); //# sourceMappingURL=vue3-quill.common.js.map