- md5
- a9fb9684cb745ab87a17b2bfea0ec0e5
- sha1
- d858ad7a335871e3d1b035a7d32e953d1ebe03da
- sha256
- b5a5bd2cd5a28ec9ec295533406ee7addc9e4152818cd8021984384da6a6c2ca
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
/**
* TinyMCE version 6.8.4 (2024-06-19)
*/
(function () {
'use strict';
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
const isSimpleType = type => value => typeof value === type;
const isBoolean = isSimpleType('boolean');
const isNumber = isSimpleType('number');
const option = name => editor => editor.options.get(name);
const register$2 = editor => {
const registerOption = editor.options.register;
registerOption('nonbreaking_force_tab', {
processor: value => {
if (isBoolean(value)) {
return {
value: value ? 3 : 0,
valid: true
};
} else if (isNumber(value)) {
return {
value,
valid: true
};
} else {
return {
valid: false,
message: 'Must be a boolean or number.'
};
}
},
default: false
});
registerOption('nonbreaking_wrap', {
processor: 'boolean',
default: true
});
};
const getKeyboardSpaces = option('nonbreaking_force_tab');
const wrapNbsps = option('nonbreaking_wrap');
const stringRepeat = (string, repeats) => {
let str = '';
for (let index = 0; index < repeats; index++) {
str += string;
}
return str;
};
const isVisualCharsEnabled = editor => editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;
const insertNbsp = (editor, times) => {
const classes = () => isVisualCharsEnabled(editor) ? 'mce-nbsp-wrap mce-nbsp' : 'mce-nbsp-wrap';
const nbspSpan = () => `<span class="${ classes() }" contenteditable="false">${ stringRepeat(' ', times) }</span>`;
const shouldWrap = wrapNbsps(editor);
const html = shouldWrap || editor.plugins.visualchars ? nbspSpan() : stringRepeat(' ', times);
editor.undoManager.transact(() => editor.insertContent(html));
};
const register$1 = editor => {
editor.addCommand('mceNonBreaking', () => {
insertNbsp(editor, 1);
});
};
var global = tinymce.util.Tools.resolve('tinymce.util.VK');
const setup = editor => {
const spaces = getKeyboardSpaces(editor);
if (spaces > 0) {
editor.on('keydown', e => {
if (e.keyCode === global.TAB && !e.isDefaultPrevented()) {
if (e.shiftKey) {
return;
}
e.preventDefault();
e.stopImmediatePropagation();
insertNbsp(editor, spaces);
}
});
}
};
const onSetupEditable = editor => api => {
const nodeChanged = () => {
api.setEnabled(editor.selection.isEditable());
};
editor.on('NodeChange', nodeChanged);
nodeChanged();
return () => {
editor.off('NodeChange', nodeChanged);
};
};
const register = editor => {
const onAction = () => editor.execCommand('mceNonBreaking');
editor.ui.registry.addButton('nonbreaking', {
icon: 'non-breaking',
tooltip: 'Nonbreaking space',
onAction,
onSetup: onSetupEditable(editor)
});
editor.ui.registry.addMenuItem('nonbreaking', {
icon: 'non-breaking',
text: 'Nonbreaking space',
onAction,
onSetup: onSetupEditable(editor)
});
};
var Plugin = () => {
global$1.add('nonbreaking', editor => {
register$2(editor);
register$1(editor);
register(editor);
setup(editor);
});
};
Plugin();
})();
The same content is in 26 releases, Joomla 5.1.3-rc1 to 5.3.0-alpha3. See them all, or every version of this file.