tiptap-vuetify
Version:
Vuetify WYSIWYG editor based on Tiptap.
1,276 lines (1,237 loc) • 41.2 kB
JavaScript
export { default as TiptapVuetify } from '~/components/TiptapVuetify.vue';
import { Heading as Heading$1, Bold as Bold$1, Italic as Italic$1, Strike as Strike$1, Underline as Underline$1, Code as Code$1, CodeBlock as CodeBlock$1, BulletList as BulletList$1, OrderedList as OrderedList$1, ListItem as ListItem$1, Blockquote as Blockquote$1, HardBreak as HardBreak$1, HorizontalRule as HorizontalRule$1, History as History$1, Link as Link$1 } from 'tiptap-extensions';
import Vue from 'vue';
import LinkWindow from '~/extensions/nativeExtensions/link/LinkWindow.vue';
var theme = {
defaultIconsGroup: "md" /* md */
};
var PACKAGE_NAME = 'tiptap-vuetify';
var EDITOR_TYPES_ENUM;
(function (EDITOR_TYPES_ENUM) {
EDITOR_TYPES_ENUM["card"] = "card";
EDITOR_TYPES_ENUM["inline"] = "inline";
})(EDITOR_TYPES_ENUM || (EDITOR_TYPES_ENUM = {}));
var ConsoleLogger = /** @class */ (function () {
function ConsoleLogger() {
}
ConsoleLogger.prototype.warn = function (msg) {
console.warn(PACKAGE_NAME + ": " + msg);
};
ConsoleLogger.prototype.error = function (msg) {
console.error(PACKAGE_NAME + ": " + msg);
};
return ConsoleLogger;
}());
var ConsoleLogger$1 = new ConsoleLogger();
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var TextIcon = /** @class */ (function () {
function TextIcon(text) {
this.text = text;
}
TextIcon.prototype.toString = function () {
return this.text;
};
return TextIcon;
}());
var 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 (_a) {
var level = _a.level;
return 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'
}
}
}
}
};
var 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 (_a) {
var level = _a.level;
return "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A " + level + " \u0443\u0440\u043E\u0432\u043D\u044F";
}
}
}
},
Link: {
buttons: {
isActive: {
tooltip: 'Изменить ссылку'
},
notActive: {
tooltip: 'Добавить ссылку'
}
},
window: {
title: 'Управление ссылкой',
form: {
hrefLabel: 'Href'
},
buttons: {
close: 'Закрыть',
remove: 'Удалить',
apply: 'Применить'
}
}
}
}
};
var 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 (_a) {
var level = _a.level;
return "Nivel de encabezado " + 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'
}
}
}
}
};
var 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 (args) { return args.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ć'
}
}
}
}
};
var 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 (args) { return args.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'
}
}
}
}
};
var defaultLanguage = 'en';
var dictionary = {
en: en,
ru: ru,
es: es,
pl: pl,
fr: fr
};
function getCurrentLang() {
return Vue.prototype.tiptapVuetifyPlugin.vuetifyLang || defaultLanguage;
}
function getMsg(path, args) {
var currentLang = getCurrentLang();
if (!dictionary[currentLang]) {
currentLang = defaultLanguage;
ConsoleLogger$1.warn("The current language \"" + currentLang + "\" is not yet available. Using language \"" + defaultLanguage + "\" by default. Contribution to github is welcome.");
}
var dictionaryByLang = dictionary[currentLang];
var target = path.split('.').reduce(function (prev, curr) {
return prev[curr];
}, dictionaryByLang);
if (target instanceof Function) {
return target(args);
}
return target;
}
var I18nText = /** @class */ (function () {
function I18nText(path, args) {
this.text = getMsg(path, args);
}
I18nText.prototype.toString = function () {
return this.text;
};
return I18nText;
}());
var ExtensionActionRenderBtn = /** @class */ (function () {
function ExtensionActionRenderBtn(options) {
var nativeExtensionName = options.nativeExtensionName;
this.options = __assign({ onClick: function (_a) {
var context = _a.context;
context.commands[nativeExtensionName](options.onClickOptions);
},
isActive: function (_a) {
var isActive = _a.isActive;
return !!isActive[nativeExtensionName] && isActive[nativeExtensionName](options.isActiveOptions);
} }, options);
}
return ExtensionActionRenderBtn;
}());
var AbstractExtension = /** @class */ (function () {
function AbstractExtension(options, extensionClass) {
this.options = options;
this.extensionClass = extensionClass;
this.nativeExtensionInstance = null;
if (extensionClass) {
// eslint-disable-next-line
this.nativeExtensionInstance = new extensionClass(options);
}
}
return AbstractExtension;
}());
var Heading = /** @class */ (function (_super) {
__extends(Heading, _super);
function Heading(options) {
return _super.call(this, options, Heading$1) || this;
}
Object.defineProperty(Heading.prototype, "availableActions", {
get: function () {
return this.options.levels.map(function (level) {
var _a;
return ({
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Heading.buttons.heading.tooltip', { level: level }),
icons: (_a = {},
_a["md" /* md */] = new TextIcon('H' + level),
_a["fa" /* fa */] = new TextIcon('H' + level),
_a["mdi" /* mdi */] = new TextIcon('H' + level),
_a),
nativeExtensionName: 'heading',
onClickOptions: { level: level },
isActiveOptions: { level: level }
})
});
});
},
enumerable: true,
configurable: true
});
return Heading;
}(AbstractExtension));
var VuetifyIcon = /** @class */ (function () {
function VuetifyIcon(name) {
this.name = name;
}
VuetifyIcon.prototype.toString = function () {
return this.name;
};
return VuetifyIcon;
}());
var Bold = /** @class */ (function (_super) {
__extends(Bold, _super);
function Bold(options) {
return _super.call(this, options, Bold$1) || this;
}
Object.defineProperty(Bold.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Bold.buttons.bold.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_bold'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-bold'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-bold'),
_a),
nativeExtensionName: 'bold'
})
}
];
},
enumerable: true,
configurable: true
});
return Bold;
}(AbstractExtension));
var Italic = /** @class */ (function (_super) {
__extends(Italic, _super);
function Italic(options) {
return _super.call(this, options, Italic$1) || this;
}
Object.defineProperty(Italic.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Italic.buttons.italic.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_italic'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-italic'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-italic'),
_a),
nativeExtensionName: 'italic'
})
}
];
},
enumerable: true,
configurable: true
});
return Italic;
}(AbstractExtension));
var Strike = /** @class */ (function (_super) {
__extends(Strike, _super);
function Strike(options) {
return _super.call(this, options, Strike$1) || this;
}
Object.defineProperty(Strike.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Strike.buttons.strike.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_strikethrough'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-strikethrough'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-strikethrough'),
_a),
nativeExtensionName: 'strike'
})
}
];
},
enumerable: true,
configurable: true
});
return Strike;
}(AbstractExtension));
var Underline = /** @class */ (function (_super) {
__extends(Underline, _super);
function Underline(options) {
return _super.call(this, options, Underline$1) || this;
}
Object.defineProperty(Underline.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Underline.buttons.underline.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_underline'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-underline'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-underline'),
_a),
nativeExtensionName: 'underline'
})
}
];
},
enumerable: true,
configurable: true
});
return Underline;
}(AbstractExtension));
// TODO текст перед / после иконки. Сделать через массив: [new VuetifyIcon('code'), new TextForIcon('text')]
var Code = /** @class */ (function (_super) {
__extends(Code, _super);
function Code(options) {
return _super.call(this, options, Code$1) || this;
}
Object.defineProperty(Code.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Code.buttons.code.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('code'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-code'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-code-tags'),
_a),
nativeExtensionName: 'code'
})
}
];
},
enumerable: true,
configurable: true
});
return Code;
}(AbstractExtension));
// TODO текст перед / после иконки. Сделать через массив: [new VuetifyIcon('code'), new TextForIcon('text')]
var CodeBlock = /** @class */ (function (_super) {
__extends(CodeBlock, _super);
function CodeBlock(options) {
return _super.call(this, options, CodeBlock$1) || this;
}
Object.defineProperty(CodeBlock.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.CodeBlock.buttons.codeBlock.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('code'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-code'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-code-tags'),
_a),
nativeExtensionName: 'code_block'
})
}
];
},
enumerable: true,
configurable: true
});
return CodeBlock;
}(AbstractExtension));
var Paragraph = /** @class */ (function (_super) {
__extends(Paragraph, _super);
function Paragraph(options) {
return _super.call(this, options, null) || this;
}
Object.defineProperty(Paragraph.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Paragraph.buttons.paragraph.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_textdirection_l_to_r'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-paragraph'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-paragraph'),
_a),
nativeExtensionName: 'paragraph'
})
}
];
},
enumerable: true,
configurable: true
});
return Paragraph;
}(AbstractExtension));
var BulletList = /** @class */ (function (_super) {
__extends(BulletList, _super);
function BulletList(options) {
return _super.call(this, options, BulletList$1) || this;
}
Object.defineProperty(BulletList.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.BulletList.buttons.bulletList.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_list_bulleted'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-list-ul'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-list-bulleted'),
_a),
nativeExtensionName: 'bullet_list'
})
}
];
},
enumerable: true,
configurable: true
});
return BulletList;
}(AbstractExtension));
var OrderedList = /** @class */ (function (_super) {
__extends(OrderedList, _super);
function OrderedList(options) {
return _super.call(this, options, OrderedList$1) || this;
}
Object.defineProperty(OrderedList.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.OrderedList.buttons.orderedList.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_list_numbered'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-list-ol'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-list-numbered'),
_a),
nativeExtensionName: 'ordered_list'
})
}
];
},
enumerable: true,
configurable: true
});
return OrderedList;
}(AbstractExtension));
var ListItem = /** @class */ (function (_super) {
__extends(ListItem, _super);
function ListItem(options) {
return _super.call(this, options, ListItem$1) || this;
}
Object.defineProperty(ListItem.prototype, "availableActions", {
get: function () {
return [];
},
enumerable: true,
configurable: true
});
return ListItem;
}(AbstractExtension));
var Blockquote = /** @class */ (function (_super) {
__extends(Blockquote, _super);
function Blockquote(options) {
return _super.call(this, options, Blockquote$1) || this;
}
Object.defineProperty(Blockquote.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.Blockquote.buttons.blockquote.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('format_quote'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-quote-right'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-format-quote-close'),
_a),
nativeExtensionName: 'blockquote'
})
}
];
},
enumerable: true,
configurable: true
});
return Blockquote;
}(AbstractExtension));
var HardBreak = /** @class */ (function (_super) {
__extends(HardBreak, _super);
function HardBreak(options) {
return _super.call(this, options, HardBreak$1) || this;
}
Object.defineProperty(HardBreak.prototype, "availableActions", {
get: function () {
return [];
},
enumerable: true,
configurable: true
});
return HardBreak;
}(AbstractExtension));
var HorizontalRule = /** @class */ (function (_super) {
__extends(HorizontalRule, _super);
function HorizontalRule(options) {
return _super.call(this, options, HorizontalRule$1) || this;
}
Object.defineProperty(HorizontalRule.prototype, "availableActions", {
get: function () {
var _a;
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.HorizontalRule.buttons.horizontalRule.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new TextIcon('—'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-minus'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-minus'),
_a),
nativeExtensionName: 'horizontal_rule'
})
}
];
},
enumerable: true,
configurable: true
});
return HorizontalRule;
}(AbstractExtension));
var History = /** @class */ (function (_super) {
__extends(History, _super);
function History(options) {
return _super.call(this, options, History$1) || this;
}
Object.defineProperty(History.prototype, "availableActions", {
get: function () {
var _a, _b;
// если не нужны кнокпи
if (this.options.noActions)
return [];
return [
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.History.buttons.undo.tooltip'),
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('undo'),
_a["fa" /* fa */] = new VuetifyIcon('fas fa-undo'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-undo'),
_a),
nativeExtensionName: 'undo'
})
},
{
render: new ExtensionActionRenderBtn({
tooltip: new I18nText('extensions.History.buttons.redo.tooltip'),
icons: (_b = {},
_b["md" /* md */] = new VuetifyIcon('redo'),
_b["fa" /* fa */] = new VuetifyIcon('fas fa-redo'),
_b["mdi" /* mdi */] = new VuetifyIcon('mdi-redo'),
_b),
nativeExtensionName: 'redo'
})
}
];
},
enumerable: true,
configurable: true
});
return History;
}(AbstractExtension));
var Link = /** @class */ (function (_super) {
__extends(Link, _super);
function Link(options) {
return _super.call(this, options, Link$1) || this;
}
Object.defineProperty(Link.prototype, "availableActions", {
get: function () {
var _a;
var nativeExtensionName = 'link';
return [
{
render: new ExtensionActionRenderBtn({
tooltip: function (context, options) { return new I18nText(options.isActive(context)
? 'extensions.Link.buttons.isActive.tooltip'
: 'extensions.Link.buttons.notActive.tooltip'); },
icons: (_a = {},
_a["md" /* md */] = new VuetifyIcon('link'),
_a["fa" /* fa */] = new VuetifyIcon('fas fas fa-link'),
_a["mdi" /* mdi */] = new VuetifyIcon('mdi-link'),
_a),
nativeExtensionName: nativeExtensionName,
onClick: function (_a) {
var context = _a.context, editor = _a.editor;
var href = context.getMarkAttrs(nativeExtensionName).href;
var LinkWindowComponent = Vue.extend(LinkWindow);
var instance = new LinkWindowComponent({
vuetify: Vue.prototype.tiptapVuetifyPlugin.vuetify,
propsData: {
value: true,
nativeExtensionName: nativeExtensionName,
context: context,
editor: editor,
href: href
}
});
instance.$mount();
document.querySelector('body').appendChild(instance.$el);
}
})
}
];
},
enumerable: true,
configurable: true
});
return Link;
}(AbstractExtension));
// export const icons = {
// save: {
// [VuetifyIconsGroups.md]: new VuetifyIcon('check'),
// [VuetifyIconsGroups.fa]: new VuetifyIcon('fas fa-check'),
// [VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-check')
// },
// cancel: {
// [VuetifyIconsGroups.md]: new VuetifyIcon('link_off'),
// [VuetifyIconsGroups.fa]: new VuetifyIcon('fas fa-unlink'),
// [VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-link-off')
// },
// linkUpdate: {
// [VuetifyIconsGroups.md]: new VuetifyIcon('link'),
// [VuetifyIconsGroups.fa]: new VuetifyIcon('fas fas fa-link'),
// [VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-link')
// },
// linkAdd: {
// [VuetifyIconsGroups.md]: new VuetifyIcon('link'),
// [VuetifyIconsGroups.fa]: new VuetifyIcon('fas fa-link'),
// [VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-link-plus')
// }
// }
// дефолтный экспорт не подходит и это плохая практика:
// It is bad practice to mix default and named exports in the same module, though it is allowed by the specification.
var TiptapVuetifyPlugin = new (/** @class */ (function () {
function Plugin() {
this.installed = false;
}
Object.defineProperty(Plugin.prototype, "vuetifyLang", {
get: function () {
return this.vuetify.framework.lang.current;
},
enumerable: true,
configurable: true
});
Plugin.prototype.install = function (VueFuncConstructor, options) {
if (!options || !options.vuetify) {
ConsoleLogger$1.error('Please, specify in options the Vuetify Object ("vuetify" property)');
return;
}
var vuetifyFramework = options.vuetify, _a = options.iconsGroup, iconsGroup = _a === void 0 ? theme.defaultIconsGroup : _a;
VueFuncConstructor.prototype.tiptapVuetifyPlugin = TiptapVuetifyPlugin;
VueFuncConstructor.prototype.$tiptapVuetify = {
iconsGroup: iconsGroup
};
this.vuetify = vuetifyFramework;
this.installed = true;
};
return Plugin;
}()))();
export { Blockquote, Bold, BulletList, Code, CodeBlock, HardBreak, Heading, History, HorizontalRule, Italic, Link, ListItem, OrderedList, Paragraph, Strike, TiptapVuetifyPlugin, Underline };