mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 18:29:39 +02:00
Updates
This commit is contained in:
parent
6efee3a800
commit
051401c6fc
803 changed files with 70126 additions and 6014 deletions
66
node_modules/tinymce/plugins/autolink/plugin.js
generated
vendored
66
node_modules/tinymce/plugins/autolink/plugin.js
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* TinyMCE version 6.1.0 (2022-06-29)
|
||||
* TinyMCE version 6.1.2 (2022-07-29)
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
@ -48,6 +48,8 @@
|
|||
};
|
||||
const isType = type => value => typeOf(value) === type;
|
||||
const isString = isType('string');
|
||||
const isNullable = a => a === null || a === undefined;
|
||||
const isNonNullable = a => !isNullable(a);
|
||||
|
||||
const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
|
||||
const contains = (str, substr) => {
|
||||
|
@ -60,9 +62,6 @@
|
|||
const rangeEqualsBracketOrSpace = rangeString => /^[(\[{ \u00a0]$/.test(rangeString);
|
||||
const isTextNode = node => node.nodeType === 3;
|
||||
const isElement = node => node.nodeType === 1;
|
||||
const handleBracket = editor => parseCurrentLine(editor, -1);
|
||||
const handleSpacebar = editor => parseCurrentLine(editor, 0);
|
||||
const handleEnter = editor => parseCurrentLine(editor, -1);
|
||||
const scopeIndex = (container, index) => {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
|
@ -92,9 +91,8 @@
|
|||
const hasProtocol = url => /^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(url);
|
||||
const isPunctuation = char => /[?!,.;:]/.test(char);
|
||||
const parseCurrentLine = (editor, endOffset) => {
|
||||
let end, endContainer, bookmark, text, prev, len, rngText;
|
||||
let end, endContainer, text, prev, len, rngText;
|
||||
const autoLinkPattern = getAutoLinkPattern(editor);
|
||||
const defaultLinkTarget = getDefaultLinkTarget(editor);
|
||||
if (editor.dom.getParent(editor.selection.getNode(), 'a[href]') !== null) {
|
||||
return;
|
||||
}
|
||||
|
@ -164,30 +162,60 @@
|
|||
} else if (contains(url, '@') && !hasProtocol(url)) {
|
||||
url = 'mailto:' + url;
|
||||
}
|
||||
bookmark = editor.selection.getBookmark();
|
||||
editor.selection.setRng(rng);
|
||||
editor.getDoc().execCommand('createlink', false, url);
|
||||
return {
|
||||
rng,
|
||||
url
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const convertToLink = (editor, result) => {
|
||||
const defaultLinkTarget = getDefaultLinkTarget(editor);
|
||||
const {rng, url} = result;
|
||||
const bookmark = editor.selection.getBookmark();
|
||||
editor.selection.setRng(rng);
|
||||
const command = 'createlink';
|
||||
const args = {
|
||||
command,
|
||||
ui: false,
|
||||
value: url
|
||||
};
|
||||
const beforeExecEvent = editor.dispatch('BeforeExecCommand', args);
|
||||
if (!beforeExecEvent.isDefaultPrevented()) {
|
||||
editor.getDoc().execCommand(command, false, url);
|
||||
editor.dispatch('ExecCommand', args);
|
||||
if (isString(defaultLinkTarget)) {
|
||||
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
|
||||
}
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
};
|
||||
const handleSpacebar = editor => {
|
||||
const result = parseCurrentLine(editor, 0);
|
||||
if (isNonNullable(result)) {
|
||||
convertToLink(editor, result);
|
||||
}
|
||||
};
|
||||
const handleBracket = handleSpacebar;
|
||||
const handleEnter = editor => {
|
||||
const result = parseCurrentLine(editor, -1);
|
||||
if (isNonNullable(result)) {
|
||||
convertToLink(editor, result);
|
||||
}
|
||||
};
|
||||
const setup = editor => {
|
||||
editor.on('keydown', e => {
|
||||
if (e.keyCode === 13) {
|
||||
return handleEnter(editor);
|
||||
}
|
||||
});
|
||||
editor.on('keypress', e => {
|
||||
if (e.keyCode === 41 || e.keyCode === 93 || e.keyCode === 125) {
|
||||
return handleBracket(editor);
|
||||
if (e.keyCode === 13 && !e.isDefaultPrevented()) {
|
||||
handleEnter(editor);
|
||||
}
|
||||
});
|
||||
editor.on('keyup', e => {
|
||||
if (e.keyCode === 32) {
|
||||
return handleSpacebar(editor);
|
||||
handleSpacebar(editor);
|
||||
} else if (e.keyCode === 48 && e.shiftKey || e.keyCode === 221) {
|
||||
handleBracket(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue