Skip to content

Commit

Permalink
Version bump: Roosterjs 8.57.0 (#2132)
Browse files Browse the repository at this point in the history
* Content Model: Clear table selection fix (#2086)

* Content Model: Clear table selection fix

* fix build

* Fix #2078 (#2092)

* Fix #2078

* add test

* Graduate feature InlineEntityReadOnlyDelimiters (#2098)

* Graduate InlineEntityReadOnlyDelimiters

* fix build

* Fix 227982 (#2095)

* Content Model: Advanced cache (#2083)

* Content Model Customization refactor

* fix build

* improve

* Content Model Customization refactor 2: Add default config

* fix build

* Content Model: Persist cache 1

* fix build

* improve

* Content Model: Cache 2

* Fix test

* Fix build

* improve

* Improve

* improve

* Improve

* fix test

* Do not restore cached selection when call select

* Content Model: Add model into ContentChangedEvent

* fix build

* add demo site page

* Improve

* Content Model: pass out segment nodes

* cache 8

* fix build

* fix test

* Improve

* improve

* fix test

* Improve

* fix test

* Improve "checkDependency"

* Content Model: Clear table selection fix

* fix build

* Content Model: Improve adjustWordSelection

* add test

* add test

* fix test

* Improve

* retrigger check step

* retrigger check step

* do not underline, if not text

* remove empty line

* refactor

* Replace tslint with eslint (#2101)

* Graduate feature ContentModelPaste (#2102)

* Remove NodeType from Content Model (#2106)

* Enable eslint rule to improve imports (#2105)

* Enable eslint rule to force import type

* Clear duplicated imports

* selection

* Content Model: Move default format logic into ContentModelFormatPlugin (#2099)

* Content Model Customization refactor

* fix build

* improve

* Content Model Customization refactor 2: Add default config

* fix build

* Content Model: Persist cache 1

* fix build

* improve

* Content Model: Cache 2

* Fix test

* Fix build

* improve

* Improve

* improve

* Improve

* fix test

* Do not restore cached selection when call select

* Content Model: Add model into ContentChangedEvent

* fix build

* add demo site page

* Improve

* Content Model: pass out segment nodes

* cache 8

* fix build

* fix test

* Improve

* improve

* fix test

* Improve

* fix test

* Improve "checkDependency"

* Content Model: Clear table selection fix

* fix build

* Content Model: Improve adjustWordSelection

* add test

* add test

* fix test

* Graduate InlineEntityReadOnlyDelimiters

* fix build

* fix test

* Refactor format plugin

* fix test

* Improve

* fix build

* Standalone editor: remove SelectionRangeEx from Content Model (#2103)

* Remove SelectionRangeEx from ContentModel

* fix test

* improve

* fix build

* fix test

* Content Model: Move copy entity related code to copyPastePlugin (#2111)

* Fix PickPlugin will not remove nodes with other tags other than <a> tag (#2116)

* Content Model: Clear cache when input in expanded selection (#2114)

* Content Model: Clear cache when input in expanded selection

* fix build

* standalone editor: Remove dependencies (#2115)

* Standalone editor: decouple entity (#2107)

* Standalone editor: decouple entity

* fix build

* fix build

* improve

* fix build

* add test

* Add announce Plugin (#2109)

Add announce plugin
Add a AnnounceHandler, that will be in charge of announcing the messages by using a aria-live element, this handler will require a string map with the localized strings to announce messages from built-in RoosterJS features.
Add an additional callback property to ContentEditEventData, getAnnounceData, used in the Announce Plugin
Add first announcing logic when indenting/outdenting list

* image selection test

* Fix demo page (#2120)

* remove height

* WIP

* Standalone editor: decouple utilities (#2123)

* fix comment

* Fix Excel Border issue when pasting (#2121)

* init

* itChromeOnly

* add unit test

* fix chrome test

* Announce Plugin, add features to current plugin (#2119)

* init

* remove

* Fix type issues

* add tests

* Fix build

* Move logic from Editor to Plugin

* Add type to param

* DefaultAnnounceString to KnownAnnounceStrings

* merge classes

* Add more details in comments

* Fix build

* const enum

* fix

* init

* Add callback that returns string

* init2

* Fix test after merge

* Refactor

* refactor

* Fix

* Dispose editor

* Move util from dom to plugin pkg & fix

* remove unneeded if

* remove unneeded test

* image selection ctrl

* refator

* rename newImage

* fix build

* Recreate Content Model for table and image selection (#2128)

* Catch error and continue when dispose editor (#2129)

* Cache error and continue when dispose editor

* Improve

* Do not focus to editor when formatWithContentModel (#2130)

* Standalone editor: Remove more dependencies (#2127)

* Standalone editor: decouple utilities

* Standalone editor: Remove more dependencies

* fix build

* remove unnecessary code

* RoosterJs 8.57.0

---------

Co-authored-by: Júlia Roldi <[email protected]>
Co-authored-by: Julia Roldi <[email protected]>
Co-authored-by: Leah Xia <[email protected]>
Co-authored-by: Bryan Valverde U <[email protected]>
  • Loading branch information
5 people authored Oct 6, 2023
1 parent 713607e commit 9079a70
Show file tree
Hide file tree
Showing 847 changed files with 13,177 additions and 3,694 deletions.
150 changes: 150 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: [
'eslint-plugin-react',
'@typescript-eslint',
'@typescript-eslint/tslint',
'eslint-plugin-import',
],
root: true,
rules: {
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/naming-convention': [
'off',
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
],
'@typescript-eslint/no-array-constructor': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/quotes': 'off',
'@typescript-eslint/typedef': [
'error',
{
parameter: true,
},
],
'brace-style': ['error', '1tbs'],
'comma-dangle': 'off',
curly: 'error',
'dot-notation': 'off',
'eol-last': 'off',
eqeqeq: ['off', 'always'],
'guard-for-in': 'error',
'id-denylist': 'error',
'id-match': 'error',
indent: 'off',
'max-len': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'off',
'no-caller': 'error',
'no-console': [
'error',
{
allow: [
'warn',
'dir',
'timeLog',
'assert',
'clear',
'count',
'countReset',
'group',
'groupEnd',
'table',
'dirxml',
'error',
'groupCollapsed',
'Console',
'profile',
'profileEnd',
'timeStamp',
'context',
],
},
],
'no-constant-condition': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-empty': 'off',
'no-empty-function': 'off',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-fallthrough': 'error',
'no-invalid-regexp': 'error',
'no-multi-str': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-redeclare': 'off',
'no-regex-spaces': 'error',
'no-restricted-syntax': [
'error',
{
message: 'Forbidden call to document.cookie',
selector: 'MemberExpression[object.name="document"][property.name="cookie"]',
},
],
'no-sparse-arrays': 'error',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
'no-unused-expressions': 'off',
'no-unused-labels': 'error',
'no-with': 'error',
quotes: 'off',
'react/no-danger': 'error',
'use-isnan': 'error',
'@typescript-eslint/tslint/config': [
'error',
{
rules: {
whitespace: [
true,
'check-branch',
'check-decl',
'check-operator',
'check-separator',
'check-type',
],
},
},
],
'import/no-duplicates': 'error',
},
};
2 changes: 2 additions & 0 deletions demo/scripts/controls/BuildInPluginState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface BuildInPluginList {
contextMenu: boolean;
autoFormat: boolean;
contentModelPaste: boolean;
announce: boolean;
}

export default interface BuildInPluginState {
Expand All @@ -34,6 +35,7 @@ export default interface BuildInPluginState {
experimentalFeatures: ExperimentalFeatures[];
forcePreserveRatio: boolean;
isRtl: boolean;
cacheModel?: boolean;
tableFeaturesContainerSelector: string;
}

Expand Down
5 changes: 4 additions & 1 deletion demo/scripts/controls/ContentModelEditorMainPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ class ContentModelEditorMainPane extends MainPaneBase {
this.toggleablePlugins = null;
this.setState({
editorCreator: (div: HTMLDivElement, options: EditorOptions) =>
new ContentModelEditor(div, options),
new ContentModelEditor(div, {
...options,
cacheModel: this.state.initState.cacheModel,
}),
});
}

Expand Down
2 changes: 1 addition & 1 deletion demo/scripts/controls/MainPaneBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import * as ReactDOM from 'react-dom';
import BuildInPluginState from './BuildInPluginState';
import SidePane from './sidePane/SidePane';
import SnapshotPlugin from './sidePane/snapshot/SnapshotPlugin';
import { EditorOptions, EditorPlugin, IEditor } from 'roosterjs-editor-types';
import { getDarkColor } from 'roosterjs-color-utils';
import { PartialTheme, ThemeProvider } from '@fluentui/react/lib/Theme';
import { registerWindowForCss, unregisterWindowForCss } from '../utils/cssMonitor';
import { trustedHTMLHandler } from '../utils/trustedHTMLHandler';
import { WindowProvider } from '@fluentui/react/lib/WindowProvider';
import { EditorOptions, EditorPlugin, IEditor } from 'roosterjs-editor-types';
import {
createUpdateContentPlugin,
Rooster,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ const styles = require('./ContentModelEntityView.scss');
export function ContentModelEntityView(props: { entity: ContentModelEntity }) {
const { entity } = props;

const [id, setId] = useProperty(entity.id);
const [isReadonly, setIsReadonly] = useProperty(entity.isReadonly);
const [type, setType] = useProperty(entity.type);
const [id, setId] = useProperty(entity.entityFormat.id);
const [isReadonly, setIsReadonly] = useProperty(entity.entityFormat.isReadonly);
const [type, setType] = useProperty(entity.entityFormat.entityType);

const idTextBox = React.useRef<HTMLInputElement>(null);
const isReadonlyCheckBox = React.useRef<HTMLInputElement>(null);
const typeTextBox = React.useRef<HTMLInputElement>(null);

const onIdChange = React.useCallback(() => {
const newValue = idTextBox.current.value;
entity.id = newValue;
entity.entityFormat.id = newValue;
setId(newValue);
}, [id, setId]);
const onTypeChange = React.useCallback(() => {
const newValue = typeTextBox.current.value;
entity.type = newValue;
entity.entityFormat.entityType = newValue;
setType(newValue);
}, [type, setType]);
const onReadonlyChange = React.useCallback(() => {
const newValue = isReadonlyCheckBox.current.checked;
entity.isReadonly = newValue;
entity.entityFormat.isReadonly = newValue;
setIsReadonly(newValue);
}, [id, setId]);

Expand Down
15 changes: 14 additions & 1 deletion demo/scripts/controls/getToggleablePlugins.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import BuildInPluginState, { BuildInPluginList, UrlPlaceholder } from './BuildInPluginState';
import { Announce } from 'roosterjs-editor-plugins/lib/Announce';
import { AutoFormat } from 'roosterjs-editor-plugins/lib/AutoFormat';
import { ContentEdit } from 'roosterjs-editor-plugins/lib/ContentEdit';
import { ContentModelPastePlugin } from 'roosterjs-content-model-editor';
import { CustomReplace as CustomReplacePlugin } from 'roosterjs-editor-plugins/lib/CustomReplace';
import { CutPasteListChain } from 'roosterjs-editor-plugins/lib/CutPasteListChain';
import { EditorPlugin } from 'roosterjs-editor-types';
import { EditorPlugin, KnownAnnounceStrings } from 'roosterjs-editor-types';
import { HyperLink } from 'roosterjs-editor-plugins/lib/HyperLink';
import { ImageEdit } from 'roosterjs-editor-plugins/lib/ImageEdit';
import { Paste } from 'roosterjs-editor-plugins/lib/Paste';
Expand Down Expand Up @@ -59,7 +60,19 @@ export default function getToggleablePlugins(initState: BuildInPluginState) {
: null,
contextMenu: pluginList.contextMenu ? createContextMenuPlugin() : null,
contentModelPaste: pluginList.contentModelPaste ? new ContentModelPastePlugin() : null,
announce: pluginList.announce ? new Announce(getDefaultStringsMap()) : null,
};

return Object.values(plugins);
}

function getDefaultStringsMap(): Map<KnownAnnounceStrings, string> {
return new Map<KnownAnnounceStrings, string>([
[KnownAnnounceStrings.AnnounceListItemBullet, 'Autocorrected Bullet'],
[KnownAnnounceStrings.AnnounceListItemNumbering, 'Autocorrected {0}'],
[
KnownAnnounceStrings.AnnounceOnFocusLastCell,
'Warning, pressing tab here adds an extra row.',
],
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import BuildInPluginState, { BuildInPluginProps, UrlPlaceholder } from '../../Bu
import ContentModelOptionsPane from './ContentModelOptionsPane';
import getDefaultContentEditFeatureSettings from './getDefaultContentEditFeatureSettings';
import SidePanePluginImpl from '../SidePanePluginImpl';
import { ExperimentalFeatures } from 'roosterjs-editor-types';
import { SidePaneElementProps } from '../SidePaneElement';

const initialState: BuildInPluginState = {
Expand All @@ -22,17 +21,16 @@ const initialState: BuildInPluginState = {
contextMenu: true,
autoFormat: true,
contentModelPaste: true,
announce: true,
},
contentEditFeatures: getDefaultContentEditFeatureSettings(),
defaultFormat: {},
linkTitle: 'Ctrl+Click to follow the link:' + UrlPlaceholder,
watermarkText: 'Type content here ...',
forcePreserveRatio: false,
experimentalFeatures: [
ExperimentalFeatures.InlineEntityReadOnlyDelimiters,
ExperimentalFeatures.ContentModelPaste,
],
experimentalFeatures: [],
isRtl: false,
cacheModel: true,
tableFeaturesContainerSelector: '#' + 'EditorContainer',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const FeatureNames: Partial<Record<ExperimentalFeatures, string>> = {
"Reuse ancestor list elements even if they don't match the types from the list item.",
[ExperimentalFeatures.DeleteTableWithBackspace]:
'Delete a table selected with the table selector pressing Backspace key',
[ExperimentalFeatures.InlineEntityReadOnlyDelimiters]:
'Add read entities around read only entities to handle browser edge cases.',
[ExperimentalFeatures.ContentModelPaste]: 'Paste with content model',
[ExperimentalFeatures.DisableListChain]: 'Disable list chain functionality',
};

Expand All @@ -38,7 +35,7 @@ export default class ContentModelExperimentalFeaturesPane extends React.Componen
id={name}
onChange={() => this.onClick(name)}
/>
<label htmlFor={name}>{FeatureNames[name]}</label>
<label htmlFor={name}>{name + ': ' + FeatureNames[name]}</label>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class ContentModelOptionsPane extends React.Component<
private exportForm = React.createRef<HTMLFormElement>();
private exportData = React.createRef<HTMLInputElement>();
private rtl = React.createRef<HTMLInputElement>();
private cacheModel = React.createRef<HTMLInputElement>();

constructor(props: BuildInPluginProps) {
super(props);
Expand Down Expand Up @@ -96,6 +97,16 @@ export default class ContentModelOptionsPane extends React.Component<
/>
<label htmlFor="pageRtl">Show controls from right to left</label>
</div>
<div>
<input
id="cacheModel"
type="checkbox"
checked={this.state.cacheModel}
onChange={this.onToggleCacheModel}
ref={this.cacheModel}
/>
<label htmlFor="cacheModel">Use Content Model Cache</label>
</div>
<hr />
<details>
<summary>
Expand Down Expand Up @@ -138,6 +149,7 @@ export default class ContentModelOptionsPane extends React.Component<
experimentalFeatures: this.state.experimentalFeatures,
forcePreserveRatio: this.state.forcePreserveRatio,
isRtl: this.state.isRtl,
cacheModel: this.state.cacheModel,
tableFeaturesContainerSelector: this.state.tableFeaturesContainerSelector,
};

Expand Down Expand Up @@ -173,6 +185,12 @@ export default class ContentModelOptionsPane extends React.Component<
MainPaneBase.getInstance().setPageDirection(isRtl);
};

private onToggleCacheModel = () => {
this.resetState(state => {
state.cacheModel = this.cacheModel.current.checked;
}, true);
};

private getHtml() {
return `${htmlStart}${htmlButtons}${darkButton}${htmlEnd}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import BuildInPluginState, { BuildInPluginProps, UrlPlaceholder } from '../../Bu
import getDefaultContentEditFeatureSettings from './getDefaultContentEditFeatureSettings';
import OptionsPane from './OptionsPane';
import SidePanePluginImpl from '../SidePanePluginImpl';
import { ExperimentalFeatures } from 'roosterjs-editor-types';
import { SidePaneElementProps } from '../SidePaneElement';

const initialState: BuildInPluginState = {
Expand All @@ -22,13 +21,14 @@ const initialState: BuildInPluginState = {
contextMenu: true,
autoFormat: true,
contentModelPaste: false,
announce: true,
},
contentEditFeatures: getDefaultContentEditFeatureSettings(),
defaultFormat: {},
linkTitle: 'Ctrl+Click to follow the link:' + UrlPlaceholder,
watermarkText: 'Type content here ...',
forcePreserveRatio: false,
experimentalFeatures: [ExperimentalFeatures.InlineEntityReadOnlyDelimiters],
experimentalFeatures: [],
isRtl: false,
tableFeaturesContainerSelector: '#' + 'EditorContainer',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ const FeatureNames: Partial<Record<ExperimentalFeatures, string>> = {
"Reuse ancestor list elements even if they don't match the types from the list item.",
[ExperimentalFeatures.DeleteTableWithBackspace]:
'Delete a table selected with the table selector pressing Backspace key',
[ExperimentalFeatures.InlineEntityReadOnlyDelimiters]:
'Add read entities around read only entities to handle browser edge cases.',
[ExperimentalFeatures.DisableListChain]: 'Disable list chain functionality',
};

Expand Down
1 change: 1 addition & 0 deletions demo/scripts/controls/sidePane/editorOptions/Plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default class Plugins extends React.Component<PluginsProps, {}> {
'Show customized context menu for special cases'
)}
{this.renderPluginItem('tableCellSelection', 'Table Cell Selection')}
{this.renderPluginItem('announce', 'Announce')}
</tbody>
</table>
);
Expand Down
Loading

0 comments on commit 9079a70

Please sign in to comment.