Skip to content

Commit 36a86bc

Browse files
authored
Merge pull request #2548 from microsoft/u/nguyenvi/versionbump0401
Bump version to 9.0.0
2 parents 49457ad + 511a7bf commit 36a86bc

File tree

545 files changed

+17925
-5756
lines changed

Some content is hidden

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

545 files changed

+17925
-5756
lines changed

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,20 @@ module.exports = {
150150
'prefer-const': 'error',
151151
'no-var': 'error',
152152
'etc/no-const-enum': ['error', { allowLocal: true }],
153+
'import/no-default-export': 'error',
153154
},
155+
overrides: [
156+
{
157+
files: [
158+
'roosterjs-editor-*/**/*.ts',
159+
'roosterjs-react/**/*.ts',
160+
'roosterjs-react/**/*.tsx',
161+
'roosterjs-color-utils/**/*.ts',
162+
'roosterjs/**/*.ts',
163+
],
164+
rules: {
165+
'import/no-default-export': 'off',
166+
},
167+
},
168+
],
154169
};

README.md

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ Rooster is a framework-independent JavaScript rich-text editor neatly nested
66
inside one HTML `<div>` element. Editing operations performed by end users are
77
handled in simple ways to generate the final HTML.
88

9-
To view the sample site, please click the link below:
9+
Rooster is working on top of a middle layer data structure called "Content Model".
10+
All format API and editing operation are using this Content Model layer as content format,
11+
and finally convert to HTML and show it in editor.
1012

11-
[RoosterJs Sample Site](https://microsoft.github.io/roosterjs/index.html).
13+
To view the demo site, please click the link below:
1214

13-
## Upgrade from RoosterJs 7.\*
15+
[RoosterJs Demo Site](https://microsoft.github.io/roosterjs/index.html).
1416

15-
Please see [here](https://github.com/microsoft/roosterjs/wiki/RoosterJs-8).
17+
## Upgrade from RoosterJs 8.\*
18+
19+
Please see [here](https://github.com/microsoft/roosterjs/wiki/RoosterJs-9).
1620

1721
## Features
1822

@@ -25,24 +29,22 @@ Rooster contains 6 basic packages.
2529
`createEditor()` function in roosterjs to create an editor with default
2630
configurations.
2731

28-
2. [roosterjs-editor-core](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_core.html):
29-
Defines the core editor and plugin infrastructure. Use `roosterjs-editor-core`
32+
2. [roosterjs-content-model-core](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_core.html):
33+
Defines the core editor and plugin infrastructure. Use `roosterjs-content-model-core`
3034
instead of `roosterjs` to build and customize your own editor.
3135

32-
3. [roosterjs-editor-api](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_api.html):
36+
3. [roosterjs-content-model-api](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_api.html):
3337
Defines APIs for editor operations. Use these APIs to modify content and
34-
formatting in the editor you built using `roosterjs-editor-core`.
38+
formatting in the editor you built using `roosterjs-content-model-core`.
3539

36-
4. [roosterjs-editor-dom](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_dom.html):
37-
Defines APIs for DOM operations. Use `roosterjs-editor-api` instead unless
38-
you want to access DOM API directly.
40+
4. [roosterjs-content-model-dom](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_dom.html):
41+
Defines APIs for Content Model and DOM operations. This package do conversion between DOM tree and roosterjs Content Model.
3942

40-
5. [roosterjs-editor-plugins](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_plugins.html):
41-
Defines basic plugins for common features. Examples: making hyperlinks,
42-
pasting HTML content, inserting inline images.
43+
5. [roosterjs-content-model-plugins](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_plugins.html):
44+
Defines basic plugins for common features.
4345

44-
6. [roosterjs-editor-types](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types.html):
45-
Defines public interfaces and enumerations.
46+
6. [roosterjs-content-model-types](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_types.html):
47+
Defines public interfaces and enumerations, including Content Model types, API parameters and other types.
4648

4749
There are also some extension packages to provide additional functionalities.
4850

@@ -52,30 +54,38 @@ There are also some extension packages to provide additional functionalities.
5254
2. [roosterjs-react](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_react.html):
5355
Provide a React wrapper of roosterjs so it can be easily used with React.
5456

55-
3. [roosterjs-editor-types-compatible](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types_compatible.html):
56-
Provide types that are compatible with isolatedModules mode. When using isolatedModules mode,
57-
"const enum" will not work correctly, this package provides enums with prefix "Compatible" in
58-
their names and they have the same value with const enums in roosterjs-editor-types package
57+
To be compatible with old (8.\*) versions, you can use `EditorAdapter` class from the following package which can act as a 8.\* Editor:
58+
59+
1. [roosterjs-editor-adapter](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_adapter.html):
60+
Provide a adapter class `EditorAdapter` to work with Editor (9.\*) and legacy plugins (via [EditorAdapterOptions.legacyPlugins](https://microsoft.github.io/roosterjs/docs/interfaces/roosterjs_editor_adapter.editoradapteroptions.html#legacyplugins))
61+
62+
And the following packages are for old (8.\*) compatibility:
63+
64+
1. [roosterjs-editor-core](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_core.html):
65+
2. [roosterjs-editor-api](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_api.html):
66+
3. [roosterjs-editor-dom](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_dom.html):
67+
4. [roosterjs-editor-plugins](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_plugins.html):
68+
5. [roosterjs-editor-types](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types.html):
69+
6. [roosterjs-editor-types-compatible](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types_compatible.html):
5970

6071
### APIs
6172

62-
Rooster provides DOM level APIs (in `roosterjs-editor-dom`), core APIs (in `roosterjs-editor-core`), and formatting APIs
63-
(in `roosterjs-editor-api`) to perform editing operations.
73+
Rooster provides Content Model level APIs (in `roosterjs-content-model-dom`), core APIs (in `roosterjs-content-model-core`), and formatting APIs
74+
(in `roosterjs-content-modelapi`) to perform editing operations.
6475

65-
`roosterjs-editor-dom` provides several levels of DOM operations:
76+
`roosterjs-content-model-dom` provides several levels of Content Model operations:
6677

67-
- Perform basic DOM operations such as `wrap()`, `unwrap()`, ...
68-
- Wrap a given DOM node with `InlineElement` or `BlockElement` and perform
69-
operations with DOM Walker API.
70-
- Perform DOM operations on a given scope using scopers.
71-
- Travel among `InlineElements` and `BlockElements` with scope using
72-
ContentTraverser API.
78+
- Create Content Model elements
79+
- Convert DOM tree to Content Model
80+
- Convert Content Model to DOM tree
81+
- Format handlers
82+
- A few DOM level API
7383

74-
`roosterjs-editor-core` provides APIs for editor core. Editor class will call such
75-
APIs to perform basic editor operations. These APIs are overridable by specifying
84+
`roosterjs-content-model-core` provides APIs for editor core. Editor class will call such
85+
APIs to perform basic editor operations. These APIs can be overridden by specifying
7686
API overrides in Editor options when creating the editor.
7787

78-
`roosterjs-editor-api` provides APIs for scenario-based operations triggered by
88+
`roosterjs-content-model-api` provides APIs for scenario-based operations triggered by
7989
user interaction.
8090

8191
## Plugins
@@ -99,7 +109,7 @@ class HelloRooster implements EditorPlugin {
99109
dispose() {}
100110

101111
onPluginEvent(e: PluginEvent) {
102-
if (e.eventType == PluginEventType.KeyPress && e.rawEvent.which == 65) {
112+
if (e.eventType == 'input' && e.rawEvent.which == 65) {
103113
alert('Hello Rooster');
104114
}
105115
}
@@ -114,9 +124,9 @@ Install via NPM or Yarn:
114124

115125
You can also install sub packages separately:
116126

117-
`yarn add roosterjs-editor-core`
127+
`yarn add roosterjs-content-model-core`
118128

119-
`yarn add roosterjs-editor-api`
129+
`yarn add roosterjs-content-model-api`
120130

121131
`...`
122132

@@ -161,9 +171,9 @@ In order to run the code below, you may also need to install [webpack](https://w
161171

162172
## Sample code
163173

164-
To view the sample site, please click [here](https://microsoft.github.io/roosterjs/index.html).
174+
To view the demo site, please click [here](https://microsoft.github.io/roosterjs/index.html).
165175

166-
To build the sample site code yourself, follow these instructions:
176+
To build the demo site code yourself, follow these instructions:
167177

168178
1. Get dependencies using [yarn](https://yarnpkg.com) or [npm](https://www.npmjs.com/):
169179

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.14.0/umd/react.production.min.js"></script>
2222
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.14.0/umd/react-dom.production.min.js"></script>
2323
<script src="https://cdnjs.cloudflare.com/ajax/libs/fluentui-react/8.60.1/fluentui-react.min.js"></script>
24+
<script src="rooster-legacy-min.js"></script>
2425
<script src="rooster-min.js"></script>
25-
<script src="rooster-content-model-min.js"></script>
2626
<script src="rooster-adapter-min.js"></script>
2727
<script src="rooster-react-min.js"></script>
2828
<script src="demo.js"></script>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const htmlButtons =
2323
'<button id=buttonRedo>Redo</button>\n';
2424
const darkButton = '<button id=buttonDark>Dark Mode</button>\n';
2525
const htmlEnd =
26-
'<script src="https://microsoft.github.io/roosterjs/rooster-min.js"></script>\n' +
26+
'<script src="https://microsoft.github.io/roosterjs/rooster-legacy-min.js"></script>\n' +
2727
'</body>\n' +
2828
'</html>';
2929

@@ -34,7 +34,7 @@ const htmlRoosterReact =
3434
'<script src="https://unpkg.com/react@16/umd/react.development.js"></script>\n' +
3535
'<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>\n' +
3636
'<script src="https://cdnjs.cloudflare.com/ajax/libs/fluentui-react/8.60.1/fluentui-react.min.js"></script>\n' +
37-
'<script src="https://microsoft.github.io/roosterjs/rooster-min.js"></script>\n' +
37+
'<script src="https://microsoft.github.io/roosterjs/rooster-legacy-min.js"></script>\n' +
3838
'<script src="https://microsoft.github.io/roosterjs/rooster-react-min.js"></script>\n' +
3939
'</body>\n' +
4040
'</html>';

demo/scripts/controls/sidePane/editorOptions/codes/ButtonsCode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import CodeElement from './CodeElement';
22
import { getObjectKeys } from 'roosterjs-editor-dom';
33

44
const codeMap: { [id: string]: string } = {
5-
buttonB: 'roosterjs.toggleBold(editor)',
6-
buttonI: 'roosterjs.toggleItalic(editor)',
7-
buttonU: 'roosterjs.toggleUnderline(editor)',
8-
buttonBullet: 'roosterjs.toggleBullet(editor)',
9-
buttonNumbering: 'roosterjs.toggleNumbering(editor)',
5+
buttonB: 'roosterjsLegacy.toggleBold(editor)',
6+
buttonI: 'roosterjsLegacy.toggleItalic(editor)',
7+
buttonU: 'roosterjsLegacy.toggleUnderline(editor)',
8+
buttonBullet: 'roosterjsLegacy.toggleBullet(editor)',
9+
buttonNumbering: 'roosterjsLegacy.toggleNumbering(editor)',
1010
buttonUndo: 'editor.undo()',
1111
buttonRedo: 'editor.redo()',
1212
};

demo/scripts/controls/sidePane/editorOptions/codes/ContentEditCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default class ContentEditCode extends CodeElement {
1010
}
1111

1212
getCode() {
13-
return 'new roosterjs.ContentEdit(' + this.features.getCode() + ')';
13+
return 'new roosterjsLegacy.ContentEdit(' + this.features.getCode() + ')';
1414
}
1515
}

demo/scripts/controls/sidePane/editorOptions/codes/DarkModeCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import CodeElement from './CodeElement';
22

33
export default class DarkModeCode extends CodeElement {
44
getCode() {
5-
return 'roosterjs.getDarkColor';
5+
return 'roosterjsLegacy.getDarkColor';
66
}
77
}

demo/scripts/controls/sidePane/editorOptions/codes/EditorCode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ export default class EditorCode extends CodeElement {
2727
let defaultFormat = this.defaultFormat.getCode();
2828
let expermientalFeatures = this.experimentalFeatures.getCode();
2929
let darkMode = this.darkMode.getCode();
30-
let code = "let contentDiv = document.getElementById('contentDiv') as HTMLDivElement;\n";
30+
let code = "let contentDiv = document.getElementById('contentDiv');\n";
3131
code += `let plugins = ${this.plugins.getCode()};\n`;
3232
code += defaultFormat ? `let defaultFormat: DefaultFormat = ${defaultFormat};\n` : '';
33-
code += 'let options: roosterjs.EditorOptions = {\n';
33+
code += 'let options = {\n';
3434
code += this.indent('plugins: plugins,\n');
3535
code += defaultFormat ? this.indent('defaultFormat: defaultFormat,\n') : '';
3636
code += expermientalFeatures
3737
? this.indent(`experimentalFeatures: [\n${expermientalFeatures}],\n`)
3838
: '';
3939
code += darkMode ? this.indent(`getDarkColor: ${darkMode},\n`) : '';
4040
code += '};\n';
41-
code += 'let editor = new roosterjs.Editor(contentDiv, options);\n';
41+
code += 'let editor = new roosterjsLegacy.Editor(contentDiv, options);\n';
4242
code += this.buttons ? this.buttons.getCode() : '';
4343

4444
return code;

demo/scripts/controls/sidePane/editorOptions/codes/HyperLinkCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default class HyperLinkCode extends CodeElement {
77
}
88

99
getCode() {
10-
return 'new roosterjs.HyperLink(' + this.getLinkCallback() + ')';
10+
return 'new roosterjsLegacy.HyperLink(' + this.getLinkCallback() + ')';
1111
}
1212

1313
private getLinkCallback() {

demo/scripts/controls/sidePane/editorOptions/codes/PluginsCode.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import ContentEditCode from './ContentEditCode';
44
import HyperLinkCode from './HyperLinkCode';
55
import TableCellSelectionCode from './TableCellSelectionCode';
66
import WatermarkCode from './WatermarkCode';
7-
import {
8-
CustomReplaceCode,
9-
CutPasteListChainCode,
10-
ImageEditCode,
11-
ContentModelPasteCode,
12-
} from './SimplePluginCode';
7+
import { CustomReplaceCode, CutPasteListChainCode, ImageEditCode } from './SimplePluginCode';
138

149
export default class PluginsCode extends CodeElement {
1510
private plugins: CodeElement[];
@@ -21,7 +16,6 @@ export default class PluginsCode extends CodeElement {
2116
this.plugins = [
2217
pluginList.contentEdit && new ContentEditCode(state.contentEditFeatures),
2318
pluginList.hyperlink && new HyperLinkCode(state.linkTitle),
24-
new ContentModelPasteCode(),
2519
pluginList.watermark && new WatermarkCode(this.state.watermarkText),
2620
pluginList.imageEdit && new ImageEditCode(),
2721
pluginList.cutPasteListChain && new CutPasteListChainCode(),

0 commit comments

Comments
 (0)