1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 18:29:39 +02:00

Libs updates and new version with option to pin videos on channel

This commit is contained in:
Daniel Neto 2024-08-05 11:37:04 -03:00
parent e1f2188de0
commit 1beab3b1c0
8565 changed files with 149805 additions and 165674 deletions

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 7.1.0 (2024-05-08)
* TinyMCE version 7.2.1 (2024-07-03)
*/
(function () {
@ -292,53 +292,6 @@
const allowUnsafeLinkTarget = option('allow_unsafe_link_target');
const useQuickLink = option('link_quicklink');
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
const getValue = item => isString(item.value) ? item.value : '';
const getText = item => {
if (isString(item.text)) {
return item.text;
} else if (isString(item.title)) {
return item.title;
} else {
return '';
}
};
const sanitizeList = (list, extractValue) => {
const out = [];
global$4.each(list, item => {
const text = getText(item);
if (item.menu !== undefined) {
const items = sanitizeList(item.menu, extractValue);
out.push({
text,
items
});
} else {
const value = extractValue(item);
out.push({
text,
value
});
}
});
return out;
};
const sanitizeWith = (extracter = getValue) => list => Optional.from(list).map(list => sanitizeList(list, extracter));
const sanitize = list => sanitizeWith(getValue)(list);
const createUi = (name, label) => items => ({
name,
type: 'listbox',
label,
items
});
const ListOptions = {
sanitize,
sanitizeWith,
createUi,
getValue
};
const keys = Object.keys;
const hasOwnProperty = Object.hasOwnProperty;
const each = (obj, f) => {
@ -365,9 +318,11 @@
const has = (obj, key) => hasOwnProperty.call(obj, key);
const hasNonNullableKey = (obj, key) => has(obj, key) && obj[key] !== undefined && obj[key] !== null;
var global$4 = tinymce.util.Tools.resolve('tinymce.util.URI');
var global$3 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
var global$2 = tinymce.util.Tools.resolve('tinymce.util.URI');
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
const isAnchor = elm => isNonNullable(elm) && elm.nodeName.toLowerCase() === 'a';
const isLink = elm => isAnchor(elm) && !!getHref(elm);
@ -396,12 +351,12 @@
const applyRelTargetRules = (rel, isUnsafe) => {
const rules = ['noopener'];
const rels = rel ? rel.split(/\s+/) : [];
const toString = rels => global$4.trim(rels.sort().join(' '));
const toString = rels => global$2.trim(rels.sort().join(' '));
const addTargetRules = rels => {
rels = removeTargetRules(rels);
return rels.length > 0 ? rels.concat(rules) : rules;
};
const removeTargetRules = rels => rels.filter(val => global$4.inArray(rules, val) === -1);
const removeTargetRules = rels => rels.filter(val => global$2.inArray(rules, val) === -1);
const newRels = isUnsafe ? addTargetRules(rels) : removeTargetRules(rels);
return newRels.length > 0 ? toString(newRels) : '';
};
@ -420,8 +375,8 @@
return trimCaretContainers(text);
};
const getLinksInSelection = rng => collectNodesInRange(rng, isLink);
const getLinks$2 = elements => global$4.grep(elements, isLink);
const hasLinks = elements => getLinks$2(elements).length > 0;
const getLinks$1 = elements => global$2.grep(elements, isLink);
const hasLinks = elements => getLinks$1(elements).length > 0;
const hasLinksInSelection = rng => getLinksInSelection(rng).length > 0;
const isOnlyTextSelected = editor => {
const inlineTextElements = editor.schema.getTextInlineElements();
@ -439,6 +394,7 @@
}
};
const isImageFigure = elm => isNonNullable(elm) && elm.nodeName === 'FIGURE' && /\bimage\b/i.test(elm.className);
const getLinkAttrs = data => {
const attrs = [
'title',
@ -565,7 +521,7 @@
const href = data.href;
return {
...data,
href: global$2.isDomSafe(href, 'a', uriOptions) ? href : ''
href: global$4.isDomSafe(href, 'a', uriOptions) ? href : ''
};
};
const link = (editor, attachState, data) => {
@ -596,6 +552,51 @@
}
};
const getValue = item => isString(item.value) ? item.value : '';
const getText = item => {
if (isString(item.text)) {
return item.text;
} else if (isString(item.title)) {
return item.title;
} else {
return '';
}
};
const sanitizeList = (list, extractValue) => {
const out = [];
global$2.each(list, item => {
const text = getText(item);
if (item.menu !== undefined) {
const items = sanitizeList(item.menu, extractValue);
out.push({
text,
items
});
} else {
const value = extractValue(item);
out.push({
text,
value
});
}
});
return out;
};
const sanitizeWith = (extracter = getValue) => list => Optional.from(list).map(list => sanitizeList(list, extracter));
const sanitize = list => sanitizeWith(getValue)(list);
const createUi = (name, label) => items => ({
name,
type: 'listbox',
label,
items
});
const ListOptions = {
sanitize,
sanitizeWith,
createUi,
getValue
};
const isListGroup = item => hasNonNullableKey(item, 'items');
const findTextByValue = (value, catalog) => findMap(catalog, item => {
if (isListGroup(item)) {
@ -754,7 +755,7 @@
return Optional.none();
}
};
const getLinks$1 = editor => {
const getLinks = editor => {
const extractor = item => editor.convertURL(item.value || item.url || '', 'href');
const linkList = getLinkList(editor);
return new Promise(resolve => {
@ -777,7 +778,7 @@
}
}));
};
const LinkListOptions = { getLinks: getLinks$1 };
const LinkListOptions = { getLinks };
const getRels = (editor, initialTarget) => {
const list = getRelList(editor);
@ -961,7 +962,7 @@
onSubmit
};
};
const open$1 = editor => {
const open = editor => {
const data = collectData(editor);
data.then(info => {
const onSubmit = handleSubmit(editor, info);
@ -974,13 +975,62 @@
const register = editor => {
editor.addCommand('mceLink', (_ui, value) => {
if ((value === null || value === void 0 ? void 0 : value.dialog) === true || !useQuickLink(editor)) {
open$1(editor);
open(editor);
} else {
editor.dispatch('contexttoolbar-show', { toolbarKey: 'quicklink' });
}
});
};
const setup$2 = editor => {
editor.addShortcut('Meta+K', '', () => {
editor.execCommand('mceLink');
});
};
const Cell = initial => {
let value = initial;
const get = () => {
return value;
};
const set = v => {
value = v;
};
return {
get,
set
};
};
const singleton = doRevoke => {
const subject = Cell(Optional.none());
const revoke = () => subject.get().each(doRevoke);
const clear = () => {
revoke();
subject.set(Optional.none());
};
const isSet = () => subject.get().isSome();
const get = () => subject.get();
const set = s => {
revoke();
subject.set(Optional.some(s));
};
return {
clear,
isSet,
get,
set
};
};
const value = () => {
const subject = singleton(noop);
const on = f => subject.get().each(f);
return {
...subject,
on
};
};
var global = tinymce.util.Tools.resolve('tinymce.util.VK');
const appendClickRemove = (link, evt) => {
@ -988,23 +1038,19 @@
link.dispatchEvent(evt);
document.body.removeChild(link);
};
const open = url => {
const openLink = url => {
const link = document.createElement('a');
link.target = '_blank';
link.href = url;
link.rel = 'noreferrer noopener';
const evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
const evt = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
document.dispatchEvent(evt);
appendClickRemove(link, evt);
};
const isSelectionOnImageWithEmbeddedLink = editor => {
const rng = editor.selection.getRng();
const node = rng.startContainer;
return isLink(node) && rng.startContainer === rng.endContainer && editor.dom.select('img', node).length === 1;
};
const getLinks = editor => editor.selection.isCollapsed() || isSelectionOnImageWithEmbeddedLink(editor) ? getLinks$2(editor.dom.getParents(editor.selection.getStart())) : getLinksInSelection(editor.selection.getRng());
const getSelectedLink = editor => getLinks(editor)[0];
const hasOnlyAltModifier = e => {
return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
};
@ -1017,33 +1063,58 @@
editor.selection.scrollIntoView(targetEl[0], true);
}
} else {
open(a.href);
openLink(a.href);
}
}
};
const openDialog = editor => () => {
editor.execCommand('mceLink', false, { dialog: true });
const isSelectionOnImageWithEmbeddedLink = editor => {
const rng = editor.selection.getRng();
const node = rng.startContainer;
return isLink(node) && rng.startContainer === rng.endContainer && editor.dom.select('img', node).length === 1;
};
const gotoSelectedLink = editor => () => {
gotoLink(editor, getSelectedLink(editor));
const getLinkFromElement = (editor, element) => {
const links = getLinks$1(editor.dom.getParents(element));
return someIf(links.length === 1, links[0]);
};
const setupGotoLinks = editor => {
const getLinkInSelection = editor => {
const links = getLinksInSelection(editor.selection.getRng());
return someIf(links.length > 0, links[0]).or(getLinkFromElement(editor, editor.selection.getNode()));
};
const getLinkFromSelection = editor => editor.selection.isCollapsed() || isSelectionOnImageWithEmbeddedLink(editor) ? getLinkFromElement(editor, editor.selection.getStart()) : getLinkInSelection(editor);
const setup$1 = editor => {
const selectedLink = value();
const getSelectedLink = () => selectedLink.get().or(getLinkFromSelection(editor));
const gotoSelectedLink = () => getSelectedLink().each(link => gotoLink(editor, link));
editor.on('contextmenu', e => {
getLinkFromElement(editor, e.target).each(selectedLink.set);
});
editor.on('SelectionChange', () => {
if (!selectedLink.isSet()) {
getLinkFromSelection(editor).each(selectedLink.set);
}
});
editor.on('click', e => {
const links = getLinks$2(editor.dom.getParents(e.target));
selectedLink.clear();
const links = getLinks$1(editor.dom.getParents(e.target));
if (links.length === 1 && global.metaKeyPressed(e)) {
e.preventDefault();
gotoLink(editor, links[0]);
}
});
editor.on('keydown', e => {
selectedLink.clear();
if (!e.isDefaultPrevented() && e.keyCode === 13 && hasOnlyAltModifier(e)) {
const link = getSelectedLink(editor);
if (link) {
getSelectedLink().each(link => {
e.preventDefault();
gotoLink(editor, link);
}
});
}
});
return { gotoSelectedLink };
};
const openDialog = editor => () => {
editor.execCommand('mceLink', false, { dialog: true });
};
const toggleState = (editor, toggler) => {
editor.on('NodeChange', toggler);
@ -1064,13 +1135,7 @@
updateState();
return toggleState(editor, updateState);
};
const hasExactlyOneLinkInSelection = editor => getLinks(editor).length === 1;
const toggleGotoLinkState = editor => api => {
const updateState = () => api.setEnabled(hasExactlyOneLinkInSelection(editor));
updateState();
return toggleState(editor, updateState);
};
const toggleUnlinkState = editor => api => {
const toggleRequiresLinkState = editor => api => {
const hasLinks$1 = parents => hasLinks(parents) || hasLinksInSelection(editor.selection.getRng());
const parents = editor.dom.getParents(editor.selection.getStart());
const updateEnabled = parents => {
@ -1079,53 +1144,46 @@
updateEnabled(parents);
return toggleState(editor, e => updateEnabled(e.parents));
};
const setup = editor => {
editor.addShortcut('Meta+K', '', () => {
editor.execCommand('mceLink');
});
};
const setupButtons = editor => {
const setupButtons = (editor, openLink) => {
editor.ui.registry.addToggleButton('link', {
icon: 'link',
tooltip: 'Insert/edit link',
shortcut: 'Meta+K',
onAction: openDialog(editor),
onSetup: toggleLinkState(editor),
shortcut: 'Meta+K'
onSetup: toggleLinkState(editor)
});
editor.ui.registry.addButton('openlink', {
icon: 'new-tab',
tooltip: 'Open link',
onAction: gotoSelectedLink(editor),
onSetup: toggleGotoLinkState(editor)
onAction: openLink.gotoSelectedLink,
onSetup: toggleRequiresLinkState(editor)
});
editor.ui.registry.addButton('unlink', {
icon: 'unlink',
tooltip: 'Remove link',
onAction: () => unlink(editor),
onSetup: toggleUnlinkState(editor)
onSetup: toggleRequiresLinkState(editor)
});
};
const setupMenuItems = editor => {
const setupMenuItems = (editor, openLink) => {
editor.ui.registry.addMenuItem('openlink', {
text: 'Open link',
icon: 'new-tab',
onAction: gotoSelectedLink(editor),
onSetup: toggleGotoLinkState(editor)
onAction: openLink.gotoSelectedLink,
onSetup: toggleRequiresLinkState(editor)
});
editor.ui.registry.addMenuItem('link', {
icon: 'link',
text: 'Link...',
shortcut: 'Meta+K',
onSetup: toggleLinkMenuState(editor),
onAction: openDialog(editor)
onAction: openDialog(editor),
onSetup: toggleLinkMenuState(editor)
});
editor.ui.registry.addMenuItem('unlink', {
icon: 'unlink',
text: 'Remove link',
onAction: () => unlink(editor),
onSetup: toggleUnlinkState(editor)
onSetup: toggleRequiresLinkState(editor)
});
};
const setupContextMenu = editor => {
@ -1141,7 +1199,7 @@
}
});
};
const setupContextToolbars = editor => {
const setupContextToolbars = (editor, openLink) => {
const collapseSelectionToEnd = editor => {
editor.selection.collapse(false);
};
@ -1219,24 +1277,27 @@
tooltip: 'Open link',
onSetup: onSetupLink,
onAction: formApi => {
gotoSelectedLink(editor)();
openLink.gotoSelectedLink();
formApi.hide();
}
}
]
});
};
const setup = editor => {
const openLink = setup$1(editor);
setupButtons(editor, openLink);
setupMenuItems(editor, openLink);
setupContextMenu(editor);
setupContextToolbars(editor, openLink);
};
var Plugin = () => {
global$5.add('link', editor => {
register$1(editor);
setupButtons(editor);
setupMenuItems(editor);
setupContextMenu(editor);
setupContextToolbars(editor);
setupGotoLinks(editor);
register(editor);
setup(editor);
setup$2(editor);
});
};