Skip to content

Commit

Permalink
Added version 6.2.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
ephox committed Sep 8, 2022
1 parent e6c8b0a commit 396dc0d
Show file tree
Hide file tree
Showing 94 changed files with 6,980 additions and 5,085 deletions.
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 6.2.0 - 2022-09-08

### Added
- New `text_patterns_lookup` option to provide additional text patterns dynamically. #TINY-8778
- New promotion element has been added to the default UI. It can be disabled using the new `promotion` option. #TINY-8840
- New `format_noneditable_selector` option to specify the `contenteditable="false"` elements that can be wrapped in a format. #TINY-8905
- Added `allow` as a valid attribute for the `iframe` element in the editor schema. #TINY-8939
- New `search` field in the `MenuButton` that shows a search field at the top of the menu, and refetches items when the search field updates. #TINY-8952

### Improved
- The formatter can now apply a format to a `contenteditable="false"` element by wrapping it. Configurable using the `format_noneditable_selector` option. #TINY-8905
- The autocompleter now supports a multiple character trigger using the new `trigger` configuration. #TINY-8887
- The formatter now applies some inline formats, such as color and font size, to list item elements when the entire item content is selected. #TINY-8961
- The installed and available plugin lists in the Help dialog are now sorted alphabetically. #TINY-9019
- Alignment can now be applied to more types of embedded media elements. #TINY-8687

### Changed
- The `@menubar-row-separator-color` oxide variable no longer affects the divider between the Menubar and Toolbar. It only controls the color of the separator lines drawn in multiline Menubars. #TINY-8632
- The `@toolbar-separator-color` oxide variable now affects the color of the separator between the Menubar and Toolbar only. #TINY-8632
- Available Premium plugins, which are listed by name in the Help dialog, are no longer translated. #TINY-9019

### Fixed
- The Autolink plugin did not work when text nodes in the content were fragmented. #TINY-3723
- Fixed multiple incorrect types on public APIs found while enabling TypeScript strict mode. #TINY-8806
- The number of blank lines returned from `editor.getContent({format: 'text'})` differed between browsers. #TINY-8579
- The editor focused via the `auto_focus` option was not scrolled into the viewport. #TINY-8785
- Adding spaces immediately after a `contenteditable="false"` block did not work properly in some circumstances. #TINY-8814
- Elements with only `data-*` custom attributes were sometimes removed when they should not be removed. #TINY-8755
- Selecting a figure with `class="image"` incorrectly highlighted the link toolbar button. #TINY-8832
- Specifying a single, non-default list style for the `advlist_bullet_styles` and `advlist_number_styles` options was not respected. #TINY-8721
- Fixed multiple issues that occurred when formatting `contenteditable` elements. #TINY-8905
- Spaces could be incorrectly added to `urlinput` dialog components (commonly but not exclusively presented in the *Insert/Edit Link* dialog) in certain cases. #TINY-8775
- The text patterns logic threw an error when there were fragmented text nodes in a paragraph. #TINY-8779
- Dragging a `contentEditable=false` element towards a document’s edge did not cause scrolling. #TINY-8874
- Parsing large documents no longer throws a `Maximum call stack size exceeded` exception. #TINY-6945
- DomParser filter matching was not checked between filters, which could lead to an exception in the parser. #TINY-8888
- `contenteditable="false"` lists can no longer be toggled; and `contenteditable="true"` list elements within these lists can no longer be indented, split into another list element, or appended to the previous list element by deletion. #TINY-8920
- Removed extra bottom padding in the context toolbar of the `tinymce-5` skin. #TINY-8980
- Fixed a regression where pressing **Enter** added or deleted content outside the selection. #TINY-9101
- Fixed a bug where pressing **Enter** deleted selected `contenteditable="false"` `<pre>` elements. #TINY-9101
- The `editor.insertContent()` API did not respect the `no_events` argument. #TINY-9140

### Deprecated
- The autocompleter configuration property, `ch`, has been deprecated. It will be removed in the next major release. Use the `trigger` property instead. #TINY-8887

## 6.1.2 - 2022-07-29

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tinymce/tinymce",
"version": "6.1.2",
"version": "6.2.0",
"description": "Web based JavaScript HTML WYSIWYG editor control.",
"license": [
"MIT-only"
Expand Down
2 changes: 2 additions & 0 deletions icons/default/icons.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion icons/default/icons.min.js

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions models/dom/model.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.1.2 (2022-07-29)
* TinyMCE version 6.2.0 (2022-09-08)
*/

(function () {
Expand Down Expand Up @@ -35,6 +35,7 @@
const isArray = isType$1('array');
const isNull = eq$2(null);
const isBoolean = isSimpleType('boolean');
const isUndefined = eq$2(undefined);
const isNullable = a => a === null || a === undefined;
const isNonNullable = a => !isNullable(a);
const isFunction = isSimpleType('function');
Expand Down Expand Up @@ -349,11 +350,9 @@
r[i] = x;
};
const internalFilter = (obj, pred, onTrue, onFalse) => {
const r = {};
each$1(obj, (x, i) => {
(pred(x, i) ? onTrue : onFalse)(x, i);
});
return r;
};
const filter$1 = (obj, pred) => {
const t = {};
Expand Down Expand Up @@ -848,8 +847,13 @@
const someIf = (b, a) => b ? Optional.some(a) : Optional.none();

const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
const contains = (str, substr) => {
return str.indexOf(substr) !== -1;
const contains = (str, substr, start = 0, end) => {
const idx = str.indexOf(substr, start);
if (idx !== -1) {
return isUndefined(end) ? true : idx + substr.length <= end;
} else {
return false;
}
};
const startsWith = (str, prefix) => {
return checkRange(str, prefix, 0);
Expand Down Expand Up @@ -4742,8 +4746,8 @@

const TableActions = (editor, resizeHandler, cellSelectionHandler) => {
const isTableBody = editor => name(getBody(editor)) === 'table';
const lastRowGuard = table => isTableBody(editor) === false || getGridSize(table).rows > 1;
const lastColumnGuard = table => isTableBody(editor) === false || getGridSize(table).columns > 1;
const lastRowGuard = table => !isTableBody(editor) || getGridSize(table).rows > 1;
const lastColumnGuard = table => !isTableBody(editor) || getGridSize(table).columns > 1;
const cloneFormats = getTableCloneElements(editor);
const colMutationOp = isResizeTableColumnResizing(editor) ? noop : halve;
const getTableSectionType = table => {
Expand Down Expand Up @@ -5242,7 +5246,7 @@
fireEvents(editor, table);
selectFirstCellInTable(editor, table);
return table.dom;
}).getOr(null);
}).getOrNull();
};
const insertTable = (editor, rows, columns, options = {}) => {
const checkInput = val => isNumber(val) && val > 0;
Expand Down Expand Up @@ -6939,7 +6943,7 @@
const bind = (element, event, handler) => bind$1(element, event, filter, handler);
const fromRawEvent = fromRawEvent$1;

const hasInternalTarget = e => has(SugarElement.fromDom(e.target), 'ephox-snooker-resizer-bar') === false;
const hasInternalTarget = e => !has(SugarElement.fromDom(e.target), 'ephox-snooker-resizer-bar');
const TableCellSelectionHandler = (editor, resizeHandler) => {
const cellSelection = Selections(() => SugarElement.fromDom(editor.getBody()), () => getSelectionCell(getSelectionStart(editor), getIsRoot(editor)), ephemera.selectedSelector);
const onSelection = (cells, start, finish) => {
Expand Down Expand Up @@ -7811,7 +7815,7 @@
}
};

const isTable = node => isNonNullable(node) && node.tagName === 'TABLE';
const isTable = node => isNonNullable(node) && node.nodeName === 'TABLE';
const barResizerPrefix = 'bar-';
const isResizable = elm => get$b(elm, 'data-mce-resize') !== 'false';
const syncPixels = table => {
Expand Down
4 changes: 2 additions & 2 deletions models/dom/model.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tinymce",
"version": "6.1.2",
"version": "6.2.0",
"repository": {
"type": "git",
"url": "https://github.com/tinymce/tinymce.git",
Expand Down
25 changes: 16 additions & 9 deletions plugins/advlist/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.1.2 (2022-07-29)
* TinyMCE version 6.2.0 (2022-09-08)
*/

(function () {
Expand Down Expand Up @@ -36,11 +36,11 @@
const getNumberStyles = option('advlist_number_styles');
const getBulletStyles = option('advlist_bullet_styles');

var global = tinymce.util.Tools.resolve('tinymce.util.Tools');

const isNullable = a => a === null || a === undefined;
const isNonNullable = a => !isNullable(a);

var global = tinymce.util.Tools.resolve('tinymce.util.Tools');

class Optional {
constructor(tag, value) {
this.tag = tag;
Expand Down Expand Up @@ -138,16 +138,21 @@
return editor.dom.isChildOf(elm, editor.getBody());
};
const isTableCellNode = node => {
return node && /^(TH|TD)$/.test(node.nodeName);
return isNonNullable(node) && /^(TH|TD)$/.test(node.nodeName);
};
const isListNode = editor => node => {
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
return isNonNullable(node) && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
};
const getSelectedStyleType = editor => {
const listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
const style = editor.dom.getStyle(listElm, 'listStyleType');
return Optional.from(style);
};
const isWithinNonEditable = (editor, element) => element !== null && editor.dom.getContentEditableParent(element) === 'false';
const isWithinNonEditableList = (editor, element) => {
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
return isWithinNonEditable(editor, parentList);
};

const findIndex = (list, predicate) => {
for (let index = 0; index < list.length; index++) {
Expand All @@ -163,6 +168,7 @@
return chr.toUpperCase();
});
};
const normalizeStyleValue = styleValue => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
const isWithinList = (editor, e, nodeName) => {
const tableCellIndex = findIndex(e.parents, isTableCellNode);
const parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
Expand All @@ -172,6 +178,7 @@
const makeSetupHandler = (editor, nodeName) => api => {
const nodeChangeHandler = e => {
api.setActive(isWithinList(editor, e, nodeName));
api.setEnabled(!isWithinNonEditableList(editor, e.element));
};
editor.on('NodeChange', nodeChangeHandler);
return () => editor.off('NodeChange', nodeChangeHandler);
Expand All @@ -186,7 +193,7 @@
const items = global.map(styles, styleValue => {
const iconStyle = nodeName === 'OL' ? 'num' : 'bull';
const iconName = styleValue === 'disc' || styleValue === 'decimal' ? 'default' : styleValue;
const itemValue = styleValue === 'default' ? '' : styleValue;
const itemValue = normalizeStyleValue(styleValue);
const displayText = styleValueToText(styleValue);
return {
type: 'choiceitem',
Expand All @@ -208,20 +215,20 @@
onSetup: makeSetupHandler(editor, nodeName)
});
};
const addButton = (editor, id, tooltip, cmd, nodeName, _styles) => {
const addButton = (editor, id, tooltip, cmd, nodeName, styleValue) => {
editor.ui.registry.addToggleButton(id, {
active: false,
tooltip,
icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
onSetup: makeSetupHandler(editor, nodeName),
onAction: () => editor.execCommand(cmd)
onAction: () => editor.queryCommandState(cmd) || styleValue === '' ? editor.execCommand(cmd) : applyListFormat(editor, nodeName, styleValue)
});
};
const addControl = (editor, id, tooltip, cmd, nodeName, styles) => {
if (styles.length > 1) {
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
} else {
addButton(editor, id, tooltip, cmd, nodeName);
addButton(editor, id, tooltip, cmd, nodeName, normalizeStyleValue(styles[0]));
}
};
const register = editor => {
Expand Down

0 comments on commit 396dc0d

Please sign in to comment.