Skip to content

Commit

Permalink
TINY-10712: Update 7.0.0 RC with new changes from main
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpyder committed Mar 11, 2024
2 parents 5a52459 + 07d1157 commit e343336
Show file tree
Hide file tree
Showing 43 changed files with 269 additions and 423 deletions.
1 change: 1 addition & 0 deletions .changes/tinymce/7.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- Updated deprecation/removed console message. #TINY-10694

### Removed
- Removed `force_hex_color` option, with the default now being all colors are forced to HEX format and as lower case #TINY-10436
- Removed the deprecated `remove_trailing_brs` option from DomParser. #TINY-10454
- Removed `title` attribute for buttons with visible label. #TINY-10453
- Removed `InsertOrderedList` and `InsertUnorderedList` commands from core. #TINY-10644
Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def props

def cacheName = "cache_${BUILD_TAG}"

def testname = "tinymce_${cleanBuildName(env.BRANCH_NAME)}_test${env.BUILD_NUMBER}"
def testPrefix = "tinymce_${cleanBuildName(env.BRANCH_NAME)}-build${env.BUILD_NUMBER}"

timestamps {
bedrockRemoteTools.nodeProducerPod(
Expand Down Expand Up @@ -208,8 +208,7 @@ timestamps {
[ browser: 'edge', provider: 'lambdatest', buckets: 1 ],
[ browser: 'chrome', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1 ],
[ browser: 'firefox', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1 ],
// [ browser: 'safari', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1, version: '17' ], // TINY-10639: Investigate Safari 17 issues
[ browser: 'safari', provider: 'lambdatest', os: 'macOS Monterey', buckets: 1, version: '15' ],
[ browser: 'safari', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1 ]
];

def processes = [:]
Expand All @@ -227,7 +226,8 @@ timestamps {
if (platform.provider) {
// use remote
def name = "${os}-${platform.browser}${browserVersion}-${platform.provider}${suffix}"
processes[name] = runTestPod(cacheName, name, testname, platform.browser, platform.provider, platform.os, platform.version, s_bucket, s_buckets, runAllTests)
def testName = "${env.BUILD_NUMBER}-${os}-${platform.browser}"
processes[name] = runTestPod(cacheName, name, "${testPrefix}_${testName}", platform.browser, platform.provider, platform.os, platform.version, s_bucket, s_buckets, runAllTests)
} else {
// use local
def name = "${os}-${platform.browser}"
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
primaryBranch=release/7
primaryBranch=main
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,7 @@ describe('browser.dragster.datatransfer.DataTransferTest', () => {
it('TINY-9601: Files list cannot be modified', () => {
const transfer = createDataTransfer();
addAndAssertFile(transfer, testFile1, 1);
if (isSafari) {
// Safari doesn't throw a TypeError on native DataTransfer.files so verify using different method
transfer.files[0] = testFile2;
assert.deepEqual(transfer.files.item(0), testFile1, 'Should still be file 1');
} else {
assertFilesCannotBeModified(transfer);
}
assertFilesCannotBeModified(transfer);
});

it('TINY-9601: Files list cannot be modified when in protected mode', () => {
Expand All @@ -209,7 +203,8 @@ describe('browser.dragster.datatransfer.DataTransferTest', () => {
});

context('clearData', () => {
it('TINY-9601: clearData should clear data as expected', () => {
// TINY-10743: Skipping until clearData behaviour is resolved
it.skip('TINY-9601: clearData should clear data as expected', () => {
const transfer = createDataTransfer();

transfer.setData('text/plain', 'Hello');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@

.tox {
.tox-revisionhistory__pane {
padding: 0 !important; /* Override the default padding of tox-view__pane */
}

.tox-revisionhistory__container {
display: flex;
flex-direction: column;
padding: 0 !important; /* Override the default padding of tox-view__pane */
height: 100%;
}

.tox-revisionhistory {
Expand Down Expand Up @@ -67,6 +71,22 @@
overflow-y: auto;
padding: @revisionhistory-card-padding;

&:focus {
height: 100%;
position: relative; // Override static which prevents z-index to have any effect
z-index: 1; // Ensure focus outline is on top of other buttons

&::after {
.keyboard-focus-outline-mixin();

border-radius: @control-border-radius;
bottom: 1px;
left: 1px;
right: 1px;
top: 1px;
}
}

.tox-revisionhistory__card {
border: @revisionhistory-border;
border-radius: @control-border-radius;
Expand Down
43 changes: 12 additions & 31 deletions modules/sugar/src/test/ts/browser/SelectionRangeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ UnitTest.test('WindowSelectionTest', () => {
finish: [ 0, 1, 0 ],
foffset: 'w'.length
},
safari: {
start: [ 0 ],
soffset: 2,
finish: [ 0, 1, 0 ],
foffset: 'w'.length
},
fallback: {
start: [ 0, 1, 0 ],
soffset: 'world'.length,
Expand All @@ -142,12 +148,6 @@ UnitTest.test('WindowSelectionTest', () => {
soffset: 0,
finish: [ 0 ],
foffset: 7
},
safari: {
start: [ 0, 0 ],
soffset: ''.length,
finish: [ 0 ],
foffset: 7
}
},
Situ.on(find( [ 0 ]), 0),
Expand All @@ -169,12 +169,6 @@ UnitTest.test('WindowSelectionTest', () => {
soffset: 7,
finish: [ 0 ],
foffset: 0
},
safari: {
start: [ 0 ],
soffset: 7,
finish: [ 0, 0 ],
foffset: ''.length
}
},
Situ.on(find( [ 0 ]), 7),
Expand All @@ -184,13 +178,6 @@ UnitTest.test('WindowSelectionTest', () => {
checkSelection(
'LTR selection (t I)',
{
// '<p>This <strong>world</strong> is not <strong>w<em>ha[</em>t</strong> I<br><br>]wanted</p><p><br>And even more</p>';
safari: {
start: [ 0, 3, 2 ],
soffset: ''.length,
finish: [ 0 ],
foffset: 6
},
fallback: {
start: [ 0, 3, 1 ],
soffset: 1,
Expand Down Expand Up @@ -224,6 +211,12 @@ UnitTest.test('WindowSelectionTest', () => {
start: [ 0 ],
soffset: 6
},
safari: {
finish: [ 0, 3, 1 ],
foffset: 1,
start: [ 0 ],
soffset: 6
},
spartan: {
finish: [ 0, 3, 1 ],
foffset: 1,
Expand Down Expand Up @@ -263,12 +256,6 @@ UnitTest.test('WindowSelectionTest', () => {
soffset: 0,
finish: [ 0 ],
foffset: 0
},
safari: {
start: [ 0, 0 ],
soffset: 0,
finish: [ 0, 0 ],
foffset: 0
}
},
Situ.on(find( [ 0 ]), 0 ),
Expand All @@ -283,12 +270,6 @@ UnitTest.test('WindowSelectionTest', () => {
soffset: 0,
finish: [ 0 ],
foffset: 0
},
safari: {
start: [ 0, 0 ],
soffset: 0,
finish: [ 0, 0 ],
foffset: 0
}
},
Situ.on(find( [ 0 ]), 0 ),
Expand Down
1 change: 0 additions & 1 deletion modules/tinymce/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"^tiny-product"
],
"dependsOn": [
"lint",
"^build"
],
"outputs": [
Expand Down
4 changes: 0 additions & 4 deletions modules/tinymce/src/core/main/ts/api/OptionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export interface ToolbarGroup {
export type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap';
export type ToolbarLocation = 'top' | 'bottom' | 'auto';

export type ForceHexColor = 'always' | 'rgb_only' | 'off';

interface BaseEditorOptions {
a11y_advanced_options?: boolean;
add_form_submit_trigger?: boolean;
Expand Down Expand Up @@ -121,7 +119,6 @@ interface BaseEditorOptions {
font_size_style_values?: string;
font_size_formats?: string;
font_size_input_default_unit?: string;
force_hex_color?: ForceHexColor;
forced_root_block?: string;
forced_root_block_attrs?: Record<string, string>;
formats?: Formats;
Expand Down Expand Up @@ -310,7 +307,6 @@ export interface EditorOptions extends NormalizedEditorOptions {
font_size_style_values: string;
forced_root_block: string;
forced_root_block_attrs: Record<string, string>;
force_hex_color: ForceHexColor;
format_noneditable_selector: string;
height: number | string;
highlight_on_focus: boolean;
Expand Down
13 changes: 1 addition & 12 deletions modules/tinymce/src/core/main/ts/api/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Pattern from '../textpatterns/core/Pattern';
import * as PatternTypes from '../textpatterns/core/PatternTypes';
import DOMUtils from './dom/DOMUtils';
import Editor from './Editor';
import { EditorOptions, ForceHexColor } from './OptionTypes';
import { EditorOptions } from './OptionTypes';
import I18n from './util/I18n';
import Tools from './util/Tools';

Expand Down Expand Up @@ -833,15 +833,6 @@ const register = (editor: Editor): void => {
default: ''
});

registerOption('force_hex_color', {
processor: (value) => {
const options: ForceHexColor[] = [ 'always', 'rgb_only', 'off' ];
const valid = Arr.contains(options, value);
return valid ? { value, valid } : { valid: false, message: `Must be one of: ${options.join(', ')}.` };
},
default: 'off',
});

registerOption('sandbox_iframes', {
processor: 'boolean',
default: true
Expand Down Expand Up @@ -984,7 +975,6 @@ const getAllowedImageFileTypes = (editor: Editor): string[] => Tools.explode(edi
const hasTableTabNavigation = option('table_tab_navigation');
const getDetailsInitialState = option('details_initial_state');
const getDetailsSerializedState = option('details_serialized_state');
const shouldForceHexColor = option('force_hex_color');
const shouldSandboxIframes = option('sandbox_iframes');
const getSandboxIframesExclusions = (editor: Editor): string[] => editor.options.get('sandbox_iframes_exclusions');
const shouldConvertUnsafeEmbeds = option('convert_unsafe_embeds');
Expand Down Expand Up @@ -1095,7 +1085,6 @@ export {
getDetailsInitialState,
getDetailsSerializedState,
shouldUseDocumentWrite,
shouldForceHexColor,
shouldSandboxIframes,
getLicenseKey,
getSandboxIframesExclusions,
Expand Down
4 changes: 1 addition & 3 deletions modules/tinymce/src/core/main/ts/api/dom/DOMUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { GeomRect } from '../geom/Rect';
import Entities from '../html/Entities';
import Schema from '../html/Schema';
import Styles, { StyleMap } from '../html/Styles';
import { ForceHexColor, URLConverter } from '../OptionTypes';
import { URLConverter } from '../OptionTypes';
import { MappedEvent } from '../util/EventDispatcher';
import Tools from '../util/Tools';
import EventUtils, { EventUtilsCallback } from './EventUtils';
Expand Down Expand Up @@ -64,7 +64,6 @@ export interface DOMUtilsSettings {
onSetAttrib: (event: SetAttribEvent) => void;
contentCssCors: boolean;
referrerPolicy: ReferrerPolicy;
force_hex_color: ForceHexColor;
}

export type Target = Node | Window;
Expand Down Expand Up @@ -339,7 +338,6 @@ const DOMUtils = (doc: Document, settings: Partial<DOMUtilsSettings> = {}): DOMU
const styles = Styles({
url_converter: settings.url_converter,
url_converter_scope: settings.url_converter_scope,
force_hex_color: settings.force_hex_color,
}, settings.schema);

const events = settings.ownEvents ? new EventUtils() : EventUtils.Event;
Expand Down
15 changes: 6 additions & 9 deletions modules/tinymce/src/core/main/ts/api/html/Styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

import { RgbaColour, Transformations } from '@ephox/acid';
import { Obj, Type, Unicode } from '@ephox/katamari';
import { Obj, Unicode } from '@ephox/katamari';

import { ForceHexColor, URLConverter } from '../OptionTypes';
import { URLConverter } from '../OptionTypes';
import Schema, { SchemaMap } from './Schema';

export type StyleMap = Record<string, string | number>;
Expand All @@ -29,7 +29,6 @@ export interface StylesSettings {
allow_svg_data_urls?: boolean;
url_converter?: URLConverter;
url_converter_scope?: any;
force_hex_color?: ForceHexColor;
}

interface Styles {
Expand All @@ -43,6 +42,7 @@ const Styles = (settings: StylesSettings = {}, schema?: Schema): Styles => {
const urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi;
const styleRegExp = /\s*([^:]+):\s*([^;]+);?/g;
const trimRightRegExp = /\s+$/;
const rgbaRegExp = /rgba *\(/i;
const encodingLookup: Record<string, string> = {};
let validStyles: Record<string, string[]> | undefined;
let invalidStyles: Record<string, SchemaMap> | undefined;
Expand Down Expand Up @@ -265,13 +265,10 @@ const Styles = (settings: StylesSettings = {}, schema?: Schema): Styles => {
value = value.toLowerCase();
}

// Convert RGB/RGBA colors to HEX
if (Type.isString(settings.force_hex_color) && settings.force_hex_color !== 'off') {
// Convert RGB colors to HEX
if (!rgbaRegExp.test(value)) {
RgbaColour.fromString(value).each((rgba) => {
// Always convert or only convert if there will be no loss of information from the alpha channel
if (settings.force_hex_color === 'always' || rgba.alpha === 1) {
value = Transformations.rgbaToHexString(RgbaColour.toString(rgba));
}
value = Transformations.rgbaToHexString(RgbaColour.toString(rgba)).toLowerCase();
});
}

Expand Down

0 comments on commit e343336

Please sign in to comment.