Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isToolbarEnabled = (editor: Editor): boolean => {
const toolbar = editor.getParam('toolbar', true);
const isToolbarTrue = toolbar === true;
const isToolbarString = Type.isString(toolbar);
const isToolbarObjectArray = Type.isArray(toolbar) && toolbar.length > 0;
// Toolbar is enabled if its value is true, a string or non-empty object array, but not string array
return !isMultipleToolbars(editor) && (isToolbarObjectArray || isToolbarString || isToolbarTrue);
};
const isHttpUrl = (url: any): boolean => {
return Type.isString(url) && /^https?/.test(url);
};
const handler = (value: string, meta?: Record) => {
if (!Type.isString(value)) {
throw new Error('Expected value to be string');
}
if (meta !== undefined && !Type.isObject(meta)) {
throw new Error('Expected meta to be a object');
}
const r: UrlData = { value, meta };
completer(r);
};
const meta = Tools.extend({ filetype }, Option.from(entry.meta).getOr({}));
}
if (Type.isString(meta.class)) {
ListUtils.findEntry(info.classList, meta.class).each((entry) => {
data.classes = entry.value;
});
}
if (info.hasImageCaption) {
if (Type.isBoolean(meta.caption)) {
data.caption = meta.caption;
}
}
if (info.hasAdvTab) {
if (Type.isString(meta.vspace)) {
data.vspace = meta.vspace;
}
if (Type.isString(meta.border)) {
data.border = meta.border;
}
if (Type.isString(meta.hspace)) {
data.hspace = meta.hspace;
}
if (Type.isString(meta.borderstyle)) {
data.borderstyle = meta.borderstyle;
}
}
};
const getTextSetting = (settings: Record, name: string, defaultValue: string): Option => {
const value = getOpt(settings, name).getOr(defaultValue);
return Type.isString(value) ? Option.some(value) : Option.none();
};
if (Type.isString(meta.height)) {
data.dimensions.height = meta.height;
}
}
if (Type.isString(meta.class)) {
ListUtils.findEntry(info.classList, meta.class).each((entry) => {
data.classes = entry.value;
});
}
if (info.hasImageCaption) {
if (Type.isBoolean(meta.caption)) {
data.caption = meta.caption;
}
}
if (info.hasAdvTab) {
if (Type.isString(meta.vspace)) {
data.vspace = meta.vspace;
}
if (Type.isString(meta.border)) {
data.border = meta.border;
}
if (Type.isString(meta.hspace)) {
data.hspace = meta.hspace;
}
if (Type.isString(meta.borderstyle)) {
data.borderstyle = meta.borderstyle;
}
}
};
data.classes = entry.value;
});
}
if (info.hasImageCaption) {
if (Type.isBoolean(meta.caption)) {
data.caption = meta.caption;
}
}
if (info.hasAdvTab) {
if (Type.isString(meta.vspace)) {
data.vspace = meta.vspace;
}
if (Type.isString(meta.border)) {
data.border = meta.border;
}
if (Type.isString(meta.hspace)) {
data.hspace = meta.hspace;
}
if (Type.isString(meta.borderstyle)) {
data.borderstyle = meta.borderstyle;
}
}
};
const formFillFromMeta2 = (info: ImageDialogInfo, data: ImageDialogData, meta: ImageDialogData['src']['meta']): void => {
if (info.hasDescription && Type.isString(meta.alt)) {
data.alt = meta.alt;
}
if (info.hasImageTitle && Type.isString(meta.title)) {
data.title = meta.title;
}
if (info.hasDimensions) {
if (Type.isString(meta.width)) {
data.dimensions.width = meta.width;
}
if (Type.isString(meta.height)) {
data.dimensions.height = meta.height;
}
}
if (Type.isString(meta.class)) {
ListUtils.findEntry(info.classList, meta.class).each((entry) => {
data.classes = entry.value;
});
}
if (info.hasImageCaption) {
if (Type.isBoolean(meta.caption)) {
data.caption = meta.caption;
}
}
if (info.hasAdvTab) {
if (Type.isString(meta.vspace)) {
data.vspace = meta.vspace;
const formFillFromMeta2 = (info: ImageDialogInfo, data: ImageDialogData, meta: ImageDialogData['src']['meta']): void => {
if (info.hasDescription && Type.isString(meta.alt)) {
data.alt = meta.alt;
}
if (info.hasImageTitle && Type.isString(meta.title)) {
data.title = meta.title;
}
if (info.hasDimensions) {
if (Type.isString(meta.width)) {
data.dimensions.width = meta.width;
}
if (Type.isString(meta.height)) {
data.dimensions.height = meta.height;
}
}
if (Type.isString(meta.class)) {
ListUtils.findEntry(info.classList, meta.class).each((entry) => {
data.classes = entry.value;