mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 18:29:39 +02:00
Updates
This commit is contained in:
parent
3b987b38bc
commit
3b90d31087
2290 changed files with 17661 additions and 11760 deletions
175
node_modules/tinymce/plugins/quickbars/plugin.js
generated
vendored
175
node_modules/tinymce/plugins/quickbars/plugin.js
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* TinyMCE version 7.5.1 (TBD)
|
||||
* TinyMCE version 7.6.0 (2024-12-11)
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
@ -7,78 +7,6 @@
|
|||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
const hasProto = (v, constructor, predicate) => {
|
||||
var _a;
|
||||
if (predicate(v, constructor.prototype)) {
|
||||
return true;
|
||||
} else {
|
||||
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
||||
}
|
||||
};
|
||||
const typeOf = x => {
|
||||
const t = typeof x;
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
} else if (t === 'object' && Array.isArray(x)) {
|
||||
return 'array';
|
||||
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
||||
return 'string';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
const isType = type => value => typeOf(value) === type;
|
||||
const isSimpleType = type => value => typeof value === type;
|
||||
const isString = isType('string');
|
||||
const isBoolean = isSimpleType('boolean');
|
||||
const isNullable = a => a === null || a === undefined;
|
||||
const isNonNullable = a => !isNullable(a);
|
||||
const isFunction = isSimpleType('function');
|
||||
|
||||
const option = name => editor => editor.options.get(name);
|
||||
const register = editor => {
|
||||
const registerOption = editor.options.register;
|
||||
const toolbarProcessor = defaultValue => value => {
|
||||
const valid = isBoolean(value) || isString(value);
|
||||
if (valid) {
|
||||
if (isBoolean(value)) {
|
||||
return {
|
||||
value: value ? defaultValue : '',
|
||||
valid
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
value: value.trim(),
|
||||
valid
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
valid: false,
|
||||
message: 'Must be a boolean or string.'
|
||||
};
|
||||
}
|
||||
};
|
||||
const defaultSelectionToolbar = 'bold italic | quicklink h2 h3 blockquote';
|
||||
registerOption('quickbars_selection_toolbar', {
|
||||
processor: toolbarProcessor(defaultSelectionToolbar),
|
||||
default: defaultSelectionToolbar
|
||||
});
|
||||
const defaultInsertToolbar = 'quickimage quicktable';
|
||||
registerOption('quickbars_insert_toolbar', {
|
||||
processor: toolbarProcessor(defaultInsertToolbar),
|
||||
default: defaultInsertToolbar
|
||||
});
|
||||
const defaultImageToolbar = 'alignleft aligncenter alignright';
|
||||
registerOption('quickbars_image_toolbar', {
|
||||
processor: toolbarProcessor(defaultImageToolbar),
|
||||
default: defaultImageToolbar
|
||||
});
|
||||
};
|
||||
const getTextSelectionToolbarItems = option('quickbars_selection_toolbar');
|
||||
const getInsertToolbarItems = option('quickbars_insert_toolbar');
|
||||
const getImageToolbarItems = option('quickbars_image_toolbar');
|
||||
|
||||
const random = () => window.crypto.getRandomValues(new Uint32Array(1))[0] / 4294967295;
|
||||
|
||||
let unique = 0;
|
||||
|
@ -155,20 +83,100 @@
|
|||
fileInput.click();
|
||||
});
|
||||
|
||||
const register$1 = editor => {
|
||||
editor.on('PreInit', () => {
|
||||
if (!editor.queryCommandSupported('QuickbarInsertImage')) {
|
||||
editor.addCommand('QuickbarInsertImage', () => {
|
||||
pickFile(editor).then(files => {
|
||||
if (files.length > 0) {
|
||||
const blob = files[0];
|
||||
blobToBase64(blob).then(base64 => {
|
||||
insertBlob(editor, base64, blob);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const hasProto = (v, constructor, predicate) => {
|
||||
var _a;
|
||||
if (predicate(v, constructor.prototype)) {
|
||||
return true;
|
||||
} else {
|
||||
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
||||
}
|
||||
};
|
||||
const typeOf = x => {
|
||||
const t = typeof x;
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
} else if (t === 'object' && Array.isArray(x)) {
|
||||
return 'array';
|
||||
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
||||
return 'string';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
const isType = type => value => typeOf(value) === type;
|
||||
const isSimpleType = type => value => typeof value === type;
|
||||
const isString = isType('string');
|
||||
const isBoolean = isSimpleType('boolean');
|
||||
const isNullable = a => a === null || a === undefined;
|
||||
const isNonNullable = a => !isNullable(a);
|
||||
const isFunction = isSimpleType('function');
|
||||
|
||||
const option = name => editor => editor.options.get(name);
|
||||
const register = editor => {
|
||||
const registerOption = editor.options.register;
|
||||
const toolbarProcessor = defaultValue => value => {
|
||||
const valid = isBoolean(value) || isString(value);
|
||||
if (valid) {
|
||||
if (isBoolean(value)) {
|
||||
return {
|
||||
value: value ? defaultValue : '',
|
||||
valid
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
value: value.trim(),
|
||||
valid
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
valid: false,
|
||||
message: 'Must be a boolean or string.'
|
||||
};
|
||||
}
|
||||
};
|
||||
const defaultSelectionToolbar = 'bold italic | quicklink h2 h3 blockquote';
|
||||
registerOption('quickbars_selection_toolbar', {
|
||||
processor: toolbarProcessor(defaultSelectionToolbar),
|
||||
default: defaultSelectionToolbar
|
||||
});
|
||||
const defaultInsertToolbar = 'quickimage quicktable';
|
||||
registerOption('quickbars_insert_toolbar', {
|
||||
processor: toolbarProcessor(defaultInsertToolbar),
|
||||
default: defaultInsertToolbar
|
||||
});
|
||||
const defaultImageToolbar = 'alignleft aligncenter alignright';
|
||||
registerOption('quickbars_image_toolbar', {
|
||||
processor: toolbarProcessor(defaultImageToolbar),
|
||||
default: defaultImageToolbar
|
||||
});
|
||||
};
|
||||
const getTextSelectionToolbarItems = option('quickbars_selection_toolbar');
|
||||
const getInsertToolbarItems = option('quickbars_insert_toolbar');
|
||||
const getImageToolbarItems = option('quickbars_image_toolbar');
|
||||
|
||||
const setupButtons = editor => {
|
||||
editor.ui.registry.addButton('quickimage', {
|
||||
icon: 'image',
|
||||
tooltip: 'Insert image',
|
||||
onAction: () => {
|
||||
pickFile(editor).then(files => {
|
||||
if (files.length > 0) {
|
||||
const blob = files[0];
|
||||
blobToBase64(blob).then(base64 => {
|
||||
insertBlob(editor, base64, blob);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
onAction: () => editor.execCommand('QuickbarInsertImage')
|
||||
});
|
||||
editor.ui.registry.addButton('quicktable', {
|
||||
icon: 'table',
|
||||
|
@ -438,6 +446,7 @@
|
|||
var Plugin = () => {
|
||||
global$1.add('quickbars', editor => {
|
||||
register(editor);
|
||||
register$1(editor);
|
||||
setupButtons(editor);
|
||||
addToEditor$1(editor);
|
||||
addToEditor(editor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue