tiptap-vuetify
Version:
Vuetify WYSIWYG editor based on Tiptap.
2 lines (1 loc) • 17.2 kB
JavaScript
"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var EDITOR_TYPES_ENUM,TiptapVuetify_vue=_interopDefault(require("~/components/TiptapVuetify.vue")),tiptapExtensions=require("tiptap-extensions"),Vue=_interopDefault(require("vue")),LinkWindow=_interopDefault(require("~/extensions/nativeExtensions/link/LinkWindow.vue")),theme={defaultIconsGroup:"md"},PACKAGE_NAME="tiptap-vuetify";!function(t){t.card="card",t.inline="inline"}(EDITOR_TYPES_ENUM||(EDITOR_TYPES_ENUM={}));var ConsoleLogger=function(){function t(){}return t.prototype.warn=function(t){console.warn(PACKAGE_NAME+": "+t)},t.prototype.error=function(t){console.error(PACKAGE_NAME+": "+t)},t}(),ConsoleLogger$1=new ConsoleLogger,extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function __extends(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var __assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},TextIcon=function(){function t(t){this.text=t}return t.prototype.toString=function(){return this.text},t}(),en={extensions:{Blockquote:{buttons:{blockquote:{tooltip:"Block quote"}}},Bold:{buttons:{bold:{tooltip:"Bold"}}},BulletList:{buttons:{bulletList:{tooltip:"Bulleted list"}}},Code:{buttons:{code:{tooltip:"Code"}}},CodeBlock:{buttons:{codeBlock:{tooltip:"Code block"}}},History:{buttons:{undo:{tooltip:"Undo"},redo:{tooltip:"Redo"}}},HorizontalRule:{buttons:{horizontalRule:{tooltip:"Horizontal line"}}},Italic:{buttons:{italic:{tooltip:"Italic"}}},OrderedList:{buttons:{orderedList:{tooltip:"Ordered list"}}},Paragraph:{buttons:{paragraph:{tooltip:"Paragraph"}}},Strike:{buttons:{strike:{tooltip:"Strike"}}},Underline:{buttons:{underline:{tooltip:"Underline"}}},Heading:{buttons:{heading:{tooltip:function(t){return t.level+" level header"}}}},Link:{buttons:{isActive:{tooltip:"Change Link"},notActive:{tooltip:"Add Link"}},window:{title:"Link control",form:{hrefLabel:"Href"},buttons:{close:"Close",remove:"Remove",apply:"Apply"}}}}},ru={extensions:{Blockquote:{buttons:{blockquote:{tooltip:"Блок цитаты"}}},Bold:{buttons:{bold:{tooltip:"Жирный"}}},BulletList:{buttons:{bulletList:{tooltip:"Маркированный список"}}},Code:{buttons:{code:{tooltip:"Код"}}},CodeBlock:{buttons:{codeBlock:{tooltip:"Блок кода"}}},History:{buttons:{undo:{tooltip:"Назад"},redo:{tooltip:"Вперед"}}},HorizontalRule:{buttons:{horizontalRule:{tooltip:"Горизонтальная линия"}}},Italic:{buttons:{italic:{tooltip:"Курсивный"}}},OrderedList:{buttons:{orderedList:{tooltip:"Упорядоченный список"}}},Paragraph:{buttons:{paragraph:{tooltip:"Параграф"}}},Strike:{buttons:{strike:{tooltip:"Перечерктнутый"}}},Underline:{buttons:{underline:{tooltip:"Подчерктнутый"}}},Heading:{buttons:{heading:{tooltip:function(t){return"Заголовок "+t.level+" уровня"}}}},Link:{buttons:{isActive:{tooltip:"Изменить ссылку"},notActive:{tooltip:"Добавить ссылку"}},window:{title:"Управление ссылкой",form:{hrefLabel:"Href"},buttons:{close:"Закрыть",remove:"Удалить",apply:"Применить"}}}}},es={extensions:{Blockquote:{buttons:{blockquote:{tooltip:"Cita en bloque"}}},Bold:{buttons:{bold:{tooltip:"Texto en negrita"}}},BulletList:{buttons:{bulletList:{tooltip:"Lista no ordenada"}}},Code:{buttons:{code:{tooltip:"Código"}}},CodeBlock:{buttons:{codeBlock:{tooltip:"Bloque de código"}}},History:{buttons:{undo:{tooltip:"Deshacer"},redo:{tooltip:"Rehacer"}}},HorizontalRule:{buttons:{horizontalRule:{tooltip:"Línea horizontal"}}},Italic:{buttons:{italic:{tooltip:"Texto en cursiva"}}},OrderedList:{buttons:{orderedList:{tooltip:"Lista ordenada"}}},Paragraph:{buttons:{paragraph:{tooltip:"Párrafo"}}},Strike:{buttons:{strike:{tooltip:"Tachar texto"}}},Underline:{buttons:{underline:{tooltip:"Subrayar texto"}}},Heading:{buttons:{heading:{tooltip:function(t){return"Nivel de encabezado "+t.level}}}},Link:{buttons:{isActive:{tooltip:"Actualizar enlace"},notActive:{tooltip:"Añadir enlace"}},window:{title:"Control de enlace",form:{hrefLabel:"Href"},buttons:{close:"Cerrar",remove:"Eliminar",apply:"Aplicar"}}}}},pl={extensions:{Blockquote:{buttons:{blockquote:{tooltip:"Blok cytatu"}}},Bold:{buttons:{bold:{tooltip:"Pogrubienie"}}},BulletList:{buttons:{bulletList:{tooltip:"Lista punktów"}}},Code:{buttons:{code:{tooltip:"Kod"}}},CodeBlock:{buttons:{codeBlock:{tooltip:"Blok kodu"}}},History:{buttons:{undo:{tooltip:"Cofnij"},redo:{tooltip:"Ponów"}}},HorizontalRule:{buttons:{horizontalRule:{tooltip:"Linia pozioma"}}},Italic:{buttons:{italic:{tooltip:"Kursywa"}}},OrderedList:{buttons:{orderedList:{tooltip:"Lista numerowana"}}},Paragraph:{buttons:{paragraph:{tooltip:"Paragraf"}}},Strike:{buttons:{strike:{tooltip:"Przekreślenie"}}},Underline:{buttons:{underline:{tooltip:"Podkreślenie"}}},Heading:{buttons:{heading:{tooltip:function(t){return t.level+" nagłówek"}}}},Link:{buttons:{isActive:{tooltip:"Zaktualizuj link"},notActive:{tooltip:"Dodaj Link"}},window:{title:"Kontrola link",form:{hrefLabel:"Href"},buttons:{close:"Zamknąć",remove:"Usunąć",apply:"Zastosować"}}}}},fr={extensions:{Blockquote:{buttons:{blockquote:{tooltip:"Bloc de citation"}}},Bold:{buttons:{bold:{tooltip:"Gras"}}},BulletList:{buttons:{bulletList:{tooltip:"Liste à puce"}}},Code:{buttons:{code:{tooltip:"Code"}}},CodeBlock:{buttons:{codeBlock:{tooltip:"Bloc de code"}}},History:{buttons:{undo:{tooltip:"Annuler"},redo:{tooltip:"Rétablir"}}},HorizontalRule:{buttons:{horizontalRule:{tooltip:"Ligne horizontale"}}},Italic:{buttons:{italic:{tooltip:"Italique"}}},OrderedList:{buttons:{orderedList:{tooltip:"Liste ordonnée"}}},Paragraph:{buttons:{paragraph:{tooltip:"Paragraphe"}}},Strike:{buttons:{strike:{tooltip:"Barré"}}},Underline:{buttons:{underline:{tooltip:"Souligné"}}},Heading:{buttons:{heading:{tooltip:function(t){return t.level+" niveau de titre"}}}},Link:{buttons:{isActive:{tooltip:"Mise à jour du lien"},notActive:{tooltip:"Ajouter un lien"}},window:{title:"Contrôle de lien",form:{hrefLabel:"Href"},buttons:{close:"Proche",remove:"Retirer",apply:"Appliquer"}}}}},defaultLanguage="en",dictionary={en:en,ru:ru,es:es,pl:pl,fr:fr};function getCurrentLang(){return Vue.prototype.tiptapVuetifyPlugin.vuetifyLang||defaultLanguage}function getMsg(t,e){var n=getCurrentLang();dictionary[n]||(n=defaultLanguage,ConsoleLogger$1.warn('The current language "'+n+'" is not yet available. Using language "'+defaultLanguage+'" by default. Contribution to github is welcome.'));var o=dictionary[n],i=t.split(".").reduce((function(t,e){return t[e]}),o);return i instanceof Function?i(e):i}var I18nText=function(){function t(t,e){this.text=getMsg(t,e)}return t.prototype.toString=function(){return this.text},t}(),ExtensionActionRenderBtn=function(t){var e=t.nativeExtensionName;this.options=__assign({onClick:function(n){n.context.commands[e](t.onClickOptions)},isActive:function(n){var o=n.isActive;return!!o[e]&&o[e](t.isActiveOptions)}},t)},AbstractExtension=function(t,e){this.options=t,this.extensionClass=e,this.nativeExtensionInstance=null,e&&(this.nativeExtensionInstance=new e(t))},Heading=function(t){function e(e){return t.call(this,e,tiptapExtensions.Heading)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){return this.options.levels.map((function(t){var e;return{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Heading.buttons.heading.tooltip",{level:t}),icons:(e={},e.md=new TextIcon("H"+t),e.fa=new TextIcon("H"+t),e.mdi=new TextIcon("H"+t),e),nativeExtensionName:"heading",onClickOptions:{level:t},isActiveOptions:{level:t}})}}))},enumerable:!0,configurable:!0}),e}(AbstractExtension),VuetifyIcon=function(){function t(t){this.name=t}return t.prototype.toString=function(){return this.name},t}(),Bold=function(t){function e(e){return t.call(this,e,tiptapExtensions.Bold)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Bold.buttons.bold.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_bold"),t.fa=new VuetifyIcon("fas fa-bold"),t.mdi=new VuetifyIcon("mdi-format-bold"),t),nativeExtensionName:"bold"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Italic=function(t){function e(e){return t.call(this,e,tiptapExtensions.Italic)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Italic.buttons.italic.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_italic"),t.fa=new VuetifyIcon("fas fa-italic"),t.mdi=new VuetifyIcon("mdi-format-italic"),t),nativeExtensionName:"italic"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Strike=function(t){function e(e){return t.call(this,e,tiptapExtensions.Strike)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Strike.buttons.strike.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_strikethrough"),t.fa=new VuetifyIcon("fas fa-strikethrough"),t.mdi=new VuetifyIcon("mdi-format-strikethrough"),t),nativeExtensionName:"strike"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Underline=function(t){function e(e){return t.call(this,e,tiptapExtensions.Underline)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Underline.buttons.underline.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_underline"),t.fa=new VuetifyIcon("fas fa-underline"),t.mdi=new VuetifyIcon("mdi-format-underline"),t),nativeExtensionName:"underline"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Code=function(t){function e(e){return t.call(this,e,tiptapExtensions.Code)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Code.buttons.code.tooltip"),icons:(t={},t.md=new VuetifyIcon("code"),t.fa=new VuetifyIcon("fas fa-code"),t.mdi=new VuetifyIcon("mdi-code-tags"),t),nativeExtensionName:"code"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),CodeBlock=function(t){function e(e){return t.call(this,e,tiptapExtensions.CodeBlock)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.CodeBlock.buttons.codeBlock.tooltip"),icons:(t={},t.md=new VuetifyIcon("code"),t.fa=new VuetifyIcon("fas fa-code"),t.mdi=new VuetifyIcon("mdi-code-tags"),t),nativeExtensionName:"code_block"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Paragraph=function(t){function e(e){return t.call(this,e,null)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Paragraph.buttons.paragraph.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_textdirection_l_to_r"),t.fa=new VuetifyIcon("fas fa-paragraph"),t.mdi=new VuetifyIcon("mdi-format-paragraph"),t),nativeExtensionName:"paragraph"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),BulletList=function(t){function e(e){return t.call(this,e,tiptapExtensions.BulletList)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.BulletList.buttons.bulletList.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_list_bulleted"),t.fa=new VuetifyIcon("fas fa-list-ul"),t.mdi=new VuetifyIcon("mdi-format-list-bulleted"),t),nativeExtensionName:"bullet_list"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),OrderedList=function(t){function e(e){return t.call(this,e,tiptapExtensions.OrderedList)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.OrderedList.buttons.orderedList.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_list_numbered"),t.fa=new VuetifyIcon("fas fa-list-ol"),t.mdi=new VuetifyIcon("mdi-format-list-numbered"),t),nativeExtensionName:"ordered_list"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),ListItem=function(t){function e(e){return t.call(this,e,tiptapExtensions.ListItem)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){return[]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Blockquote=function(t){function e(e){return t.call(this,e,tiptapExtensions.Blockquote)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.Blockquote.buttons.blockquote.tooltip"),icons:(t={},t.md=new VuetifyIcon("format_quote"),t.fa=new VuetifyIcon("fas fa-quote-right"),t.mdi=new VuetifyIcon("mdi-format-quote-close"),t),nativeExtensionName:"blockquote"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),HardBreak=function(t){function e(e){return t.call(this,e,tiptapExtensions.HardBreak)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){return[]},enumerable:!0,configurable:!0}),e}(AbstractExtension),HorizontalRule=function(t){function e(e){return t.call(this,e,tiptapExtensions.HorizontalRule)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.HorizontalRule.buttons.horizontalRule.tooltip"),icons:(t={},t.md=new TextIcon("—"),t.fa=new VuetifyIcon("fas fa-minus"),t.mdi=new VuetifyIcon("mdi-minus"),t),nativeExtensionName:"horizontal_rule"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),History=function(t){function e(e){return t.call(this,e,tiptapExtensions.History)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t,e;return this.options.noActions?[]:[{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.History.buttons.undo.tooltip"),icons:(t={},t.md=new VuetifyIcon("undo"),t.fa=new VuetifyIcon("fas fa-undo"),t.mdi=new VuetifyIcon("mdi-undo"),t),nativeExtensionName:"undo"})},{render:new ExtensionActionRenderBtn({tooltip:new I18nText("extensions.History.buttons.redo.tooltip"),icons:(e={},e.md=new VuetifyIcon("redo"),e.fa=new VuetifyIcon("fas fa-redo"),e.mdi=new VuetifyIcon("mdi-redo"),e),nativeExtensionName:"redo"})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),Link=function(t){function e(e){return t.call(this,e,tiptapExtensions.Link)||this}return __extends(e,t),Object.defineProperty(e.prototype,"availableActions",{get:function(){var t;return[{render:new ExtensionActionRenderBtn({tooltip:function(t,e){return new I18nText(e.isActive(t)?"extensions.Link.buttons.isActive.tooltip":"extensions.Link.buttons.notActive.tooltip")},icons:(t={},t.md=new VuetifyIcon("link"),t.fa=new VuetifyIcon("fas fas fa-link"),t.mdi=new VuetifyIcon("mdi-link"),t),nativeExtensionName:"link",onClick:function(t){var e=t.context,n=t.editor,o=e.getMarkAttrs("link").href,i=new(Vue.extend(LinkWindow))({vuetify:Vue.prototype.tiptapVuetifyPlugin.vuetify,propsData:{value:!0,nativeExtensionName:"link",context:e,editor:n,href:o}});i.$mount(),document.querySelector("body").appendChild(i.$el)}})}]},enumerable:!0,configurable:!0}),e}(AbstractExtension),TiptapVuetifyPlugin=new(function(){function t(){this.installed=!1}return Object.defineProperty(t.prototype,"vuetifyLang",{get:function(){return this.vuetify.framework.lang.current},enumerable:!0,configurable:!0}),t.prototype.install=function(t,e){if(e&&e.vuetify){var n=e.vuetify,o=e.iconsGroup,i=void 0===o?theme.defaultIconsGroup:o;t.prototype.tiptapVuetifyPlugin=TiptapVuetifyPlugin,t.prototype.$tiptapVuetify={iconsGroup:i},this.vuetify=n,this.installed=!0}else ConsoleLogger$1.error('Please, specify in options the Vuetify Object ("vuetify" property)')},t}());exports.TiptapVuetify=TiptapVuetify_vue,exports.Blockquote=Blockquote,exports.Bold=Bold,exports.BulletList=BulletList,exports.Code=Code,exports.CodeBlock=CodeBlock,exports.HardBreak=HardBreak,exports.Heading=Heading,exports.History=History,exports.HorizontalRule=HorizontalRule,exports.Italic=Italic,exports.Link=Link,exports.ListItem=ListItem,exports.OrderedList=OrderedList,exports.Paragraph=Paragraph,exports.Strike=Strike,exports.TiptapVuetifyPlugin=TiptapVuetifyPlugin,exports.Underline=Underline;