@syncfusion/ej2-richtexteditor
Version:
Essential JS 2 RichTextEditor component
521 lines (520 loc) • 18.8 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
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);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Property, ChildProperty } from '@syncfusion/ej2-base';
import { ToolbarType } from '../common/enum';
import { backgroundColor, fontColor, fontFamily, fontSize, formatItems, predefinedItems, TableStyleItems, numberFormatList, bulletFormatList, codeBlockList } from '../models/items';
import { ToolbarPosition } from '../editor-manager/base/enum';
/**
* Configures the toolbar settings of the RichTextEditor.
*/
var ToolbarSettings = /** @class */ (function (_super) {
__extends(ToolbarSettings, _super);
function ToolbarSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(true)
], ToolbarSettings.prototype, "enable", void 0);
__decorate([
Property(true)
], ToolbarSettings.prototype, "enableFloating", void 0);
__decorate([
Property(ToolbarType.Expand)
], ToolbarSettings.prototype, "type", void 0);
__decorate([
Property(predefinedItems)
], ToolbarSettings.prototype, "items", void 0);
__decorate([
Property({})
], ToolbarSettings.prototype, "itemConfigs", void 0);
__decorate([
Property(ToolbarPosition.Top)
], ToolbarSettings.prototype, "position", void 0);
return ToolbarSettings;
}(ChildProperty));
export { ToolbarSettings };
/**
* Configures the importWord settings of the RichTextEditor.
*/
var ImportWord = /** @class */ (function (_super) {
__extends(ImportWord, _super);
function ImportWord() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(null)
], ImportWord.prototype, "serviceUrl", void 0);
return ImportWord;
}(ChildProperty));
export { ImportWord };
/**
* Configures the export settings for Word format in the RichTextEditor.
*/
var ExportWord = /** @class */ (function (_super) {
__extends(ExportWord, _super);
function ExportWord() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(null)
], ExportWord.prototype, "serviceUrl", void 0);
__decorate([
Property('Sample.docx')
], ExportWord.prototype, "fileName", void 0);
__decorate([
Property(null)
], ExportWord.prototype, "stylesheet", void 0);
return ExportWord;
}(ChildProperty));
export { ExportWord };
/**
* Configures the export settings for PDF format in the RichTextEditor.
*/
var ExportPdf = /** @class */ (function (_super) {
__extends(ExportPdf, _super);
function ExportPdf() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(null)
], ExportPdf.prototype, "serviceUrl", void 0);
__decorate([
Property('Sample.pdf')
], ExportPdf.prototype, "fileName", void 0);
__decorate([
Property(null)
], ExportPdf.prototype, "stylesheet", void 0);
return ExportPdf;
}(ChildProperty));
export { ExportPdf };
/**
* Configures the image settings of the RichTextEditor.
*/
var ImageSettings = /** @class */ (function (_super) {
__extends(ImageSettings, _super);
function ImageSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(['.jpeg', '.jpg', '.png'])
], ImageSettings.prototype, "allowedTypes", void 0);
__decorate([
Property('inline')
], ImageSettings.prototype, "display", void 0);
__decorate([
Property('Blob')
], ImageSettings.prototype, "saveFormat", void 0);
__decorate([
Property('auto')
], ImageSettings.prototype, "width", void 0);
__decorate([
Property('auto')
], ImageSettings.prototype, "height", void 0);
__decorate([
Property(null)
], ImageSettings.prototype, "saveUrl", void 0);
__decorate([
Property(null)
], ImageSettings.prototype, "path", void 0);
__decorate([
Property(true)
], ImageSettings.prototype, "resize", void 0);
__decorate([
Property(null)
], ImageSettings.prototype, "removeUrl", void 0);
__decorate([
Property(0)
], ImageSettings.prototype, "minWidth", void 0);
__decorate([
Property(null)
], ImageSettings.prototype, "maxWidth", void 0);
__decorate([
Property(0)
], ImageSettings.prototype, "minHeight", void 0);
__decorate([
Property(null)
], ImageSettings.prototype, "maxHeight", void 0);
__decorate([
Property(false)
], ImageSettings.prototype, "resizeByPercent", void 0);
__decorate([
Property(30000000)
], ImageSettings.prototype, "maxFileSize", void 0);
return ImageSettings;
}(ChildProperty));
export { ImageSettings };
/**
* Configures the audio settings of the RichTextEditor.
*/
var AudioSettings = /** @class */ (function (_super) {
__extends(AudioSettings, _super);
function AudioSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(['.wav', '.mp3', '.m4a', '.wma'])
], AudioSettings.prototype, "allowedTypes", void 0);
__decorate([
Property('Inline')
], AudioSettings.prototype, "layoutOption", void 0);
__decorate([
Property('Blob')
], AudioSettings.prototype, "saveFormat", void 0);
__decorate([
Property(null)
], AudioSettings.prototype, "saveUrl", void 0);
__decorate([
Property(null)
], AudioSettings.prototype, "removeUrl", void 0);
__decorate([
Property(null)
], AudioSettings.prototype, "path", void 0);
__decorate([
Property(30000000)
], AudioSettings.prototype, "maxFileSize", void 0);
return AudioSettings;
}(ChildProperty));
export { AudioSettings };
/**
* Configures the video settings of the RichTextEditor.
*/
var VideoSettings = /** @class */ (function (_super) {
__extends(VideoSettings, _super);
function VideoSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(['.mp4', '.mov', '.wmv', '.avi'])
], VideoSettings.prototype, "allowedTypes", void 0);
__decorate([
Property('Inline')
], VideoSettings.prototype, "layoutOption", void 0);
__decorate([
Property('Blob')
], VideoSettings.prototype, "saveFormat", void 0);
__decorate([
Property('auto')
], VideoSettings.prototype, "width", void 0);
__decorate([
Property('auto')
], VideoSettings.prototype, "height", void 0);
__decorate([
Property(null)
], VideoSettings.prototype, "saveUrl", void 0);
__decorate([
Property(null)
], VideoSettings.prototype, "path", void 0);
__decorate([
Property(true)
], VideoSettings.prototype, "resize", void 0);
__decorate([
Property(null)
], VideoSettings.prototype, "removeUrl", void 0);
__decorate([
Property(0)
], VideoSettings.prototype, "minWidth", void 0);
__decorate([
Property(null)
], VideoSettings.prototype, "maxWidth", void 0);
__decorate([
Property(0)
], VideoSettings.prototype, "minHeight", void 0);
__decorate([
Property(null)
], VideoSettings.prototype, "maxHeight", void 0);
__decorate([
Property(false)
], VideoSettings.prototype, "resizeByPercent", void 0);
__decorate([
Property(30000000)
], VideoSettings.prototype, "maxFileSize", void 0);
return VideoSettings;
}(ChildProperty));
export { VideoSettings };
var TableSettings = /** @class */ (function (_super) {
__extends(TableSettings, _super);
function TableSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property('100%')
], TableSettings.prototype, "width", void 0);
__decorate([
Property(TableStyleItems)
], TableSettings.prototype, "styles", void 0);
__decorate([
Property(true)
], TableSettings.prototype, "resize", void 0);
__decorate([
Property(0)
], TableSettings.prototype, "minWidth", void 0);
__decorate([
Property(null)
], TableSettings.prototype, "maxWidth", void 0);
return TableSettings;
}(ChildProperty));
export { TableSettings };
/**
* Configures the quick toolbar settings of the RichTextEditor.
*/
var QuickToolbarSettings = /** @class */ (function (_super) {
__extends(QuickToolbarSettings, _super);
function QuickToolbarSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(true)
], QuickToolbarSettings.prototype, "enable", void 0);
__decorate([
Property(false)
], QuickToolbarSettings.prototype, "showOnRightClick", void 0);
__decorate([
Property('none')
], QuickToolbarSettings.prototype, "actionOnScroll", void 0);
__decorate([
Property(['Open', 'Edit', 'UnLink'])
], QuickToolbarSettings.prototype, "link", void 0);
__decorate([
Property(['AltText', 'Caption', '|', 'Align', 'Display', '|', 'InsertLink', 'OpenImageLink', 'EditImageLink', 'RemoveImageLink', '|', 'Dimension', 'Replace', 'Remove'])
], QuickToolbarSettings.prototype, "image", void 0);
__decorate([
Property(['AudioLayoutOption', 'AudioReplace', 'AudioRemove'])
], QuickToolbarSettings.prototype, "audio", void 0);
__decorate([
Property(['VideoLayoutOption', 'VideoAlign', '|', 'VideoDimension', 'VideoReplace', 'VideoRemove'])
], QuickToolbarSettings.prototype, "video", void 0);
__decorate([
Property(null)
], QuickToolbarSettings.prototype, "text", void 0);
__decorate([
Property(['Tableheader', 'TableRemove', '|', 'TableRows', 'TableColumns', '|', 'Styles', 'BackgroundColor', 'Alignments', 'TableCellVerticalAlign'])
], QuickToolbarSettings.prototype, "table", void 0);
return QuickToolbarSettings;
}(ChildProperty));
export { QuickToolbarSettings };
/**
* Configures the format painter settings of the RichTextEditor.
*/
var FormatPainterSettings = /** @class */ (function (_super) {
__extends(FormatPainterSettings, _super);
function FormatPainterSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property('b; em; font; sub; sup; kbd; i; s; u; code; strong; span; p; div; h1; h2; h3; h4; h5; h6; blockquote; ol; ul; li; pre;')
], FormatPainterSettings.prototype, "allowedFormats", void 0);
__decorate([
Property(null)
], FormatPainterSettings.prototype, "deniedFormats", void 0);
return FormatPainterSettings;
}(ChildProperty));
export { FormatPainterSettings };
/**
* Configures the paste cleanup settings of the RichTextEditor.
*/
var PasteCleanupSettings = /** @class */ (function (_super) {
__extends(PasteCleanupSettings, _super);
function PasteCleanupSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(false)
], PasteCleanupSettings.prototype, "prompt", void 0);
__decorate([
Property(null)
], PasteCleanupSettings.prototype, "deniedAttrs", void 0);
__decorate([
Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'list-style-type', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-transform', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width', 'flex-direction'])
], PasteCleanupSettings.prototype, "allowedStyleProps", void 0);
__decorate([
Property(null)
], PasteCleanupSettings.prototype, "deniedTags", void 0);
__decorate([
Property(true)
], PasteCleanupSettings.prototype, "keepFormat", void 0);
__decorate([
Property(false)
], PasteCleanupSettings.prototype, "plainText", void 0);
return PasteCleanupSettings;
}(ChildProperty));
export { PasteCleanupSettings };
/**
* Configures the font family settings of the RichTextEditor.
*/
var FontFamily = /** @class */ (function (_super) {
__extends(FontFamily, _super);
function FontFamily() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(null)
], FontFamily.prototype, "default", void 0);
__decorate([
Property('72px')
], FontFamily.prototype, "width", void 0);
__decorate([
Property(fontFamily)
], FontFamily.prototype, "items", void 0);
return FontFamily;
}(ChildProperty));
export { FontFamily };
/**
* Configures the font size settings of the RichTextEditor.
*/
var FontSize = /** @class */ (function (_super) {
__extends(FontSize, _super);
function FontSize() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(null)
], FontSize.prototype, "default", void 0);
__decorate([
Property('60px')
], FontSize.prototype, "width", void 0);
__decorate([
Property(fontSize)
], FontSize.prototype, "items", void 0);
return FontSize;
}(ChildProperty));
export { FontSize };
/**
* Configures the format settings of the RichTextEditor.
*/
var Format = /** @class */ (function (_super) {
__extends(Format, _super);
function Format() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(null)
], Format.prototype, "default", void 0);
__decorate([
Property('65px')
], Format.prototype, "width", void 0);
__decorate([
Property(formatItems)
], Format.prototype, "types", void 0);
return Format;
}(ChildProperty));
export { Format };
/**
* Configures the font color settings of the RichTextEditor.
*/
var FontColor = /** @class */ (function (_super) {
__extends(FontColor, _super);
function FontColor() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property('#ff0000')
], FontColor.prototype, "default", void 0);
__decorate([
Property('Palette')
], FontColor.prototype, "mode", void 0);
__decorate([
Property(10)
], FontColor.prototype, "columns", void 0);
__decorate([
Property(fontColor)
], FontColor.prototype, "colorCode", void 0);
__decorate([
Property(false)
], FontColor.prototype, "modeSwitcher", void 0);
__decorate([
Property(true)
], FontColor.prototype, "showRecentColors", void 0);
return FontColor;
}(ChildProperty));
export { FontColor };
/**
* Configures the background color settings of the RichTextEditor.
*/
var BackgroundColor = /** @class */ (function (_super) {
__extends(BackgroundColor, _super);
function BackgroundColor() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property('#ffff00')
], BackgroundColor.prototype, "default", void 0);
__decorate([
Property('Palette')
], BackgroundColor.prototype, "mode", void 0);
__decorate([
Property(10)
], BackgroundColor.prototype, "columns", void 0);
__decorate([
Property(backgroundColor)
], BackgroundColor.prototype, "colorCode", void 0);
__decorate([
Property(false)
], BackgroundColor.prototype, "modeSwitcher", void 0);
__decorate([
Property(true)
], BackgroundColor.prototype, "showRecentColors", void 0);
return BackgroundColor;
}(ChildProperty));
export { BackgroundColor };
/**
* Configures the settings for the number format list in the RichTextEditor.
*/
var NumberFormatList = /** @class */ (function (_super) {
__extends(NumberFormatList, _super);
function NumberFormatList() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(numberFormatList)
], NumberFormatList.prototype, "types", void 0);
return NumberFormatList;
}(ChildProperty));
export { NumberFormatList };
/**
* Configures the settings for the bullet format list in the RichTextEditor.
*/
var BulletFormatList = /** @class */ (function (_super) {
__extends(BulletFormatList, _super);
function BulletFormatList() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(bulletFormatList)
], BulletFormatList.prototype, "types", void 0);
return BulletFormatList;
}(ChildProperty));
export { BulletFormatList };
/**
* Configures the settings for the code block list in the RichTextEditor.
*/
var CodeBlockSettings = /** @class */ (function (_super) {
__extends(CodeBlockSettings, _super);
function CodeBlockSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
Property(codeBlockList)
], CodeBlockSettings.prototype, "languages", void 0);
__decorate([
Property('plaintext')
], CodeBlockSettings.prototype, "defaultLanguage", void 0);
return CodeBlockSettings;
}(ChildProperty));
export { CodeBlockSettings };