Skip to content

Commit 9079a70

Browse files
JiuqingSongjuliaroldiLeah-Xia-MicrosoftBryanValverdeU
authored
Version bump: Roosterjs 8.57.0 (#2132)
* 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 <juliaroldi@microsoft.com> Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com> Co-authored-by: Leah Xia <107075081+Leah-Xia-Microsoft@users.noreply.github.com> Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>
1 parent 713607e commit 9079a70

File tree

847 files changed

+13177
-3694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

847 files changed

+13177
-3694
lines changed

.eslintrc.js

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3+
https://github.com/typescript-eslint/tslint-to-eslint-config
4+
5+
It represents the closest reasonable ESLint configuration to this
6+
project's original TSLint configuration.
7+
8+
We recommend eventually switching this configuration to extend from
9+
the recommended rulesets in typescript-eslint.
10+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11+
12+
Happy linting! 💖
13+
*/
14+
module.exports = {
15+
env: {
16+
browser: true,
17+
es6: true,
18+
node: true,
19+
},
20+
parser: '@typescript-eslint/parser',
21+
parserOptions: {
22+
project: 'tsconfig.json',
23+
sourceType: 'module',
24+
},
25+
plugins: [
26+
'eslint-plugin-react',
27+
'@typescript-eslint',
28+
'@typescript-eslint/tslint',
29+
'eslint-plugin-import',
30+
],
31+
root: true,
32+
rules: {
33+
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
34+
'@typescript-eslint/dot-notation': 'error',
35+
'@typescript-eslint/explicit-function-return-type': 'off',
36+
'@typescript-eslint/explicit-module-boundary-types': 'off',
37+
'@typescript-eslint/indent': 'off',
38+
'@typescript-eslint/naming-convention': [
39+
'off',
40+
{
41+
selector: 'variable',
42+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
43+
leadingUnderscore: 'forbid',
44+
trailingUnderscore: 'forbid',
45+
},
46+
],
47+
'@typescript-eslint/no-array-constructor': 'off',
48+
'@typescript-eslint/no-dynamic-delete': 'off',
49+
'@typescript-eslint/no-empty-function': 'off',
50+
'@typescript-eslint/no-empty-interface': 'off',
51+
'@typescript-eslint/no-namespace': 'error',
52+
'@typescript-eslint/no-unused-expressions': 'off',
53+
'@typescript-eslint/no-var-requires': 'off',
54+
'@typescript-eslint/quotes': 'off',
55+
'@typescript-eslint/typedef': [
56+
'error',
57+
{
58+
parameter: true,
59+
},
60+
],
61+
'brace-style': ['error', '1tbs'],
62+
'comma-dangle': 'off',
63+
curly: 'error',
64+
'dot-notation': 'off',
65+
'eol-last': 'off',
66+
eqeqeq: ['off', 'always'],
67+
'guard-for-in': 'error',
68+
'id-denylist': 'error',
69+
'id-match': 'error',
70+
indent: 'off',
71+
'max-len': 'off',
72+
'no-array-constructor': 'off',
73+
'no-bitwise': 'off',
74+
'no-caller': 'error',
75+
'no-console': [
76+
'error',
77+
{
78+
allow: [
79+
'warn',
80+
'dir',
81+
'timeLog',
82+
'assert',
83+
'clear',
84+
'count',
85+
'countReset',
86+
'group',
87+
'groupEnd',
88+
'table',
89+
'dirxml',
90+
'error',
91+
'groupCollapsed',
92+
'Console',
93+
'profile',
94+
'profileEnd',
95+
'timeStamp',
96+
'context',
97+
],
98+
},
99+
],
100+
'no-constant-condition': 'error',
101+
'no-control-regex': 'error',
102+
'no-debugger': 'error',
103+
'no-duplicate-case': 'error',
104+
'no-empty': 'off',
105+
'no-empty-function': 'off',
106+
'no-eval': 'error',
107+
'no-extra-bind': 'error',
108+
'no-fallthrough': 'error',
109+
'no-invalid-regexp': 'error',
110+
'no-multi-str': 'error',
111+
'no-new-func': 'error',
112+
'no-new-wrappers': 'error',
113+
'no-octal': 'error',
114+
'no-octal-escape': 'error',
115+
'no-redeclare': 'off',
116+
'no-regex-spaces': 'error',
117+
'no-restricted-syntax': [
118+
'error',
119+
{
120+
message: 'Forbidden call to document.cookie',
121+
selector: 'MemberExpression[object.name="document"][property.name="cookie"]',
122+
},
123+
],
124+
'no-sparse-arrays': 'error',
125+
'no-trailing-spaces': 'error',
126+
'no-underscore-dangle': 'off',
127+
'no-unused-expressions': 'off',
128+
'no-unused-labels': 'error',
129+
'no-with': 'error',
130+
quotes: 'off',
131+
'react/no-danger': 'error',
132+
'use-isnan': 'error',
133+
'@typescript-eslint/tslint/config': [
134+
'error',
135+
{
136+
rules: {
137+
whitespace: [
138+
true,
139+
'check-branch',
140+
'check-decl',
141+
'check-operator',
142+
'check-separator',
143+
'check-type',
144+
],
145+
},
146+
},
147+
],
148+
'import/no-duplicates': 'error',
149+
},
150+
};

demo/scripts/controls/BuildInPluginState.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface BuildInPluginList {
2323
contextMenu: boolean;
2424
autoFormat: boolean;
2525
contentModelPaste: boolean;
26+
announce: boolean;
2627
}
2728

2829
export default interface BuildInPluginState {
@@ -34,6 +35,7 @@ export default interface BuildInPluginState {
3435
experimentalFeatures: ExperimentalFeatures[];
3536
forcePreserveRatio: boolean;
3637
isRtl: boolean;
38+
cacheModel?: boolean;
3739
tableFeaturesContainerSelector: string;
3840
}
3941

demo/scripts/controls/ContentModelEditorMainPane.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ class ContentModelEditorMainPane extends MainPaneBase {
182182
this.toggleablePlugins = null;
183183
this.setState({
184184
editorCreator: (div: HTMLDivElement, options: EditorOptions) =>
185-
new ContentModelEditor(div, options),
185+
new ContentModelEditor(div, {
186+
...options,
187+
cacheModel: this.state.initState.cacheModel,
188+
}),
186189
});
187190
}
188191

demo/scripts/controls/MainPaneBase.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import * as ReactDOM from 'react-dom';
33
import BuildInPluginState from './BuildInPluginState';
44
import SidePane from './sidePane/SidePane';
55
import SnapshotPlugin from './sidePane/snapshot/SnapshotPlugin';
6-
import { EditorOptions, EditorPlugin, IEditor } from 'roosterjs-editor-types';
76
import { getDarkColor } from 'roosterjs-color-utils';
87
import { PartialTheme, ThemeProvider } from '@fluentui/react/lib/Theme';
98
import { registerWindowForCss, unregisterWindowForCss } from '../utils/cssMonitor';
109
import { trustedHTMLHandler } from '../utils/trustedHTMLHandler';
1110
import { WindowProvider } from '@fluentui/react/lib/WindowProvider';
11+
import { EditorOptions, EditorPlugin, IEditor } from 'roosterjs-editor-types';
1212
import {
1313
createUpdateContentPlugin,
1414
Rooster,

demo/scripts/controls/contentModel/components/model/ContentModelEntityView.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ const styles = require('./ContentModelEntityView.scss');
1010
export function ContentModelEntityView(props: { entity: ContentModelEntity }) {
1111
const { entity } = props;
1212

13-
const [id, setId] = useProperty(entity.id);
14-
const [isReadonly, setIsReadonly] = useProperty(entity.isReadonly);
15-
const [type, setType] = useProperty(entity.type);
13+
const [id, setId] = useProperty(entity.entityFormat.id);
14+
const [isReadonly, setIsReadonly] = useProperty(entity.entityFormat.isReadonly);
15+
const [type, setType] = useProperty(entity.entityFormat.entityType);
1616

1717
const idTextBox = React.useRef<HTMLInputElement>(null);
1818
const isReadonlyCheckBox = React.useRef<HTMLInputElement>(null);
1919
const typeTextBox = React.useRef<HTMLInputElement>(null);
2020

2121
const onIdChange = React.useCallback(() => {
2222
const newValue = idTextBox.current.value;
23-
entity.id = newValue;
23+
entity.entityFormat.id = newValue;
2424
setId(newValue);
2525
}, [id, setId]);
2626
const onTypeChange = React.useCallback(() => {
2727
const newValue = typeTextBox.current.value;
28-
entity.type = newValue;
28+
entity.entityFormat.entityType = newValue;
2929
setType(newValue);
3030
}, [type, setType]);
3131
const onReadonlyChange = React.useCallback(() => {
3232
const newValue = isReadonlyCheckBox.current.checked;
33-
entity.isReadonly = newValue;
33+
entity.entityFormat.isReadonly = newValue;
3434
setIsReadonly(newValue);
3535
}, [id, setId]);
3636

demo/scripts/controls/getToggleablePlugins.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import BuildInPluginState, { BuildInPluginList, UrlPlaceholder } from './BuildInPluginState';
2+
import { Announce } from 'roosterjs-editor-plugins/lib/Announce';
23
import { AutoFormat } from 'roosterjs-editor-plugins/lib/AutoFormat';
34
import { ContentEdit } from 'roosterjs-editor-plugins/lib/ContentEdit';
45
import { ContentModelPastePlugin } from 'roosterjs-content-model-editor';
56
import { CustomReplace as CustomReplacePlugin } from 'roosterjs-editor-plugins/lib/CustomReplace';
67
import { CutPasteListChain } from 'roosterjs-editor-plugins/lib/CutPasteListChain';
7-
import { EditorPlugin } from 'roosterjs-editor-types';
8+
import { EditorPlugin, KnownAnnounceStrings } from 'roosterjs-editor-types';
89
import { HyperLink } from 'roosterjs-editor-plugins/lib/HyperLink';
910
import { ImageEdit } from 'roosterjs-editor-plugins/lib/ImageEdit';
1011
import { Paste } from 'roosterjs-editor-plugins/lib/Paste';
@@ -59,7 +60,19 @@ export default function getToggleablePlugins(initState: BuildInPluginState) {
5960
: null,
6061
contextMenu: pluginList.contextMenu ? createContextMenuPlugin() : null,
6162
contentModelPaste: pluginList.contentModelPaste ? new ContentModelPastePlugin() : null,
63+
announce: pluginList.announce ? new Announce(getDefaultStringsMap()) : null,
6264
};
6365

6466
return Object.values(plugins);
6567
}
68+
69+
function getDefaultStringsMap(): Map<KnownAnnounceStrings, string> {
70+
return new Map<KnownAnnounceStrings, string>([
71+
[KnownAnnounceStrings.AnnounceListItemBullet, 'Autocorrected Bullet'],
72+
[KnownAnnounceStrings.AnnounceListItemNumbering, 'Autocorrected {0}'],
73+
[
74+
KnownAnnounceStrings.AnnounceOnFocusLastCell,
75+
'Warning, pressing tab here adds an extra row.',
76+
],
77+
]);
78+
}

demo/scripts/controls/sidePane/editorOptions/ContentModelEditorOptionsPlugin.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import BuildInPluginState, { BuildInPluginProps, UrlPlaceholder } from '../../Bu
22
import ContentModelOptionsPane from './ContentModelOptionsPane';
33
import getDefaultContentEditFeatureSettings from './getDefaultContentEditFeatureSettings';
44
import SidePanePluginImpl from '../SidePanePluginImpl';
5-
import { ExperimentalFeatures } from 'roosterjs-editor-types';
65
import { SidePaneElementProps } from '../SidePaneElement';
76

87
const initialState: BuildInPluginState = {
@@ -22,17 +21,16 @@ const initialState: BuildInPluginState = {
2221
contextMenu: true,
2322
autoFormat: true,
2423
contentModelPaste: true,
24+
announce: true,
2525
},
2626
contentEditFeatures: getDefaultContentEditFeatureSettings(),
2727
defaultFormat: {},
2828
linkTitle: 'Ctrl+Click to follow the link:' + UrlPlaceholder,
2929
watermarkText: 'Type content here ...',
3030
forcePreserveRatio: false,
31-
experimentalFeatures: [
32-
ExperimentalFeatures.InlineEntityReadOnlyDelimiters,
33-
ExperimentalFeatures.ContentModelPaste,
34-
],
31+
experimentalFeatures: [],
3532
isRtl: false,
33+
cacheModel: true,
3634
tableFeaturesContainerSelector: '#' + 'EditorContainer',
3735
};
3836

demo/scripts/controls/sidePane/editorOptions/ContentModelExperimentalFeatures.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ const FeatureNames: Partial<Record<ExperimentalFeatures, string>> = {
1414
"Reuse ancestor list elements even if they don't match the types from the list item.",
1515
[ExperimentalFeatures.DeleteTableWithBackspace]:
1616
'Delete a table selected with the table selector pressing Backspace key',
17-
[ExperimentalFeatures.InlineEntityReadOnlyDelimiters]:
18-
'Add read entities around read only entities to handle browser edge cases.',
19-
[ExperimentalFeatures.ContentModelPaste]: 'Paste with content model',
2017
[ExperimentalFeatures.DisableListChain]: 'Disable list chain functionality',
2118
};
2219

@@ -38,7 +35,7 @@ export default class ContentModelExperimentalFeaturesPane extends React.Componen
3835
id={name}
3936
onChange={() => this.onClick(name)}
4037
/>
41-
<label htmlFor={name}>{FeatureNames[name]}</label>
38+
<label htmlFor={name}>{name + ': ' + FeatureNames[name]}</label>
4239
</div>
4340
);
4441
}

demo/scripts/controls/sidePane/editorOptions/ContentModelOptionsPane.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default class ContentModelOptionsPane extends React.Component<
3434
private exportForm = React.createRef<HTMLFormElement>();
3535
private exportData = React.createRef<HTMLInputElement>();
3636
private rtl = React.createRef<HTMLInputElement>();
37+
private cacheModel = React.createRef<HTMLInputElement>();
3738

3839
constructor(props: BuildInPluginProps) {
3940
super(props);
@@ -96,6 +97,16 @@ export default class ContentModelOptionsPane extends React.Component<
9697
/>
9798
<label htmlFor="pageRtl">Show controls from right to left</label>
9899
</div>
100+
<div>
101+
<input
102+
id="cacheModel"
103+
type="checkbox"
104+
checked={this.state.cacheModel}
105+
onChange={this.onToggleCacheModel}
106+
ref={this.cacheModel}
107+
/>
108+
<label htmlFor="cacheModel">Use Content Model Cache</label>
109+
</div>
99110
<hr />
100111
<details>
101112
<summary>
@@ -138,6 +149,7 @@ export default class ContentModelOptionsPane extends React.Component<
138149
experimentalFeatures: this.state.experimentalFeatures,
139150
forcePreserveRatio: this.state.forcePreserveRatio,
140151
isRtl: this.state.isRtl,
152+
cacheModel: this.state.cacheModel,
141153
tableFeaturesContainerSelector: this.state.tableFeaturesContainerSelector,
142154
};
143155

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

188+
private onToggleCacheModel = () => {
189+
this.resetState(state => {
190+
state.cacheModel = this.cacheModel.current.checked;
191+
}, true);
192+
};
193+
176194
private getHtml() {
177195
return `${htmlStart}${htmlButtons}${darkButton}${htmlEnd}`;
178196
}

demo/scripts/controls/sidePane/editorOptions/EditorOptionsPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import BuildInPluginState, { BuildInPluginProps, UrlPlaceholder } from '../../Bu
22
import getDefaultContentEditFeatureSettings from './getDefaultContentEditFeatureSettings';
33
import OptionsPane from './OptionsPane';
44
import SidePanePluginImpl from '../SidePanePluginImpl';
5-
import { ExperimentalFeatures } from 'roosterjs-editor-types';
65
import { SidePaneElementProps } from '../SidePaneElement';
76

87
const initialState: BuildInPluginState = {
@@ -22,13 +21,14 @@ const initialState: BuildInPluginState = {
2221
contextMenu: true,
2322
autoFormat: true,
2423
contentModelPaste: false,
24+
announce: true,
2525
},
2626
contentEditFeatures: getDefaultContentEditFeatureSettings(),
2727
defaultFormat: {},
2828
linkTitle: 'Ctrl+Click to follow the link:' + UrlPlaceholder,
2929
watermarkText: 'Type content here ...',
3030
forcePreserveRatio: false,
31-
experimentalFeatures: [ExperimentalFeatures.InlineEntityReadOnlyDelimiters],
31+
experimentalFeatures: [],
3232
isRtl: false,
3333
tableFeaturesContainerSelector: '#' + 'EditorContainer',
3434
};

0 commit comments

Comments
 (0)