Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 9.0.0 #2548

Merged
merged 108 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
6a4c0a4
entity on enter
juliaroldi Mar 7, 2024
4e32cd9
WIP
juliaroldi Mar 8, 2024
e6b6ba3
WIP
juliaroldi Mar 8, 2024
8dad9cb
import model button
juliaroldi Mar 15, 2024
ea284cf
Enable Content Model cache by default (#2498)
JiuqingSong Mar 16, 2024
08a7411
Move public type definitions into roosterjs-content-model-type packag…
JiuqingSong Mar 16, 2024
5f83453
import model button
juliaroldi Mar 18, 2024
3d1a46a
Merge branch 'master' into u/juliaroldi/import-model
juliaroldi Mar 18, 2024
d3bd81b
fixes
juliaroldi Mar 18, 2024
365e055
Merge branch 'u/juliaroldi/import-model' of https://github.com/micros…
juliaroldi Mar 18, 2024
f9a70a1
fixes
juliaroldi Mar 18, 2024
7eca6ba
remove typecast
juliaroldi Mar 18, 2024
4c5087c
FHL: Port WatermarkPlugin (#2503)
JiuqingSong Mar 18, 2024
9ccde1a
Bump follow-redirects from 1.15.4 to 1.15.6 (#2512)
dependabot[bot] Mar 18, 2024
5ecaa6e
Merge branch 'master' into u/juliaroldi/import-model
BryanValverdeU Mar 18, 2024
767edaa
Reorganize core API and core Plugin files (#2501)
JiuqingSong Mar 18, 2024
f1e124c
copy format
juliaroldi Mar 18, 2024
60b61a1
Merge branch 'u/juliaroldi/import-model' of https://github.com/micros…
juliaroldi Mar 18, 2024
171b823
Merge branch 'master' into u/juliaroldi/import-model
juliaroldi Mar 18, 2024
d55c892
Merge pull request #2509 from microsoft/u/juliaroldi/import-model
juliaroldi Mar 18, 2024
dfe7073
fix test
juliaroldi Mar 18, 2024
722743e
conflicts
juliaroldi Mar 18, 2024
cbe2205
fix convertGlobalCssToInlineCss() to process pseudo-classes correctly…
ganialhamad Mar 19, 2024
6783957
Merge branch 'master' into u/juliaroldi/entity-features
juliaroldi Mar 19, 2024
23390a8
markdown
juliaroldi Mar 19, 2024
ca960e2
Add tabs to demo site and PresetPlugin (#2511)
Andres-CT98 Mar 19, 2024
936016f
markdown plugin
juliaroldi Mar 19, 2024
fe1830d
remove code for selection
juliaroldi Mar 19, 2024
b8ecbc1
Merge branch 'master' into u/juliaroldi/entity-features
juliaroldi Mar 19, 2024
27e52d0
fixes
juliaroldi Mar 20, 2024
60ca0dd
Merge branch 'u/juliaroldi/entity-features' of https://github.com/mic…
juliaroldi Mar 20, 2024
b8fad47
multiple imports
juliaroldi Mar 20, 2024
2d6cae1
FHL: Port TableCellSelection plugin (#2506)
JiuqingSong Mar 20, 2024
1c50878
Add setLogicalRoot API (#2492)
florian-msft Mar 20, 2024
0d00be9
handle shift
juliaroldi Mar 20, 2024
a05a9cf
fix conflicts
juliaroldi Mar 20, 2024
1fcb1b4
fix imports
juliaroldi Mar 20, 2024
fb8603c
Merge pull request #2497 from microsoft/u/juliaroldi/entity-features
juliaroldi Mar 20, 2024
65ea84c
Add eslint rule to disallow default export (#2515)
JiuqingSong Mar 20, 2024
5fb56cf
Merge branch 'master' into u/juliaroldi/fix-shift-tab
juliaroldi Mar 20, 2024
79dc022
Merge pull request #2514 from microsoft/u/juliaroldi/fix-shift-tab
juliaroldi Mar 20, 2024
d615454
Patch: Fix paste issue for repaste (#2516)
JiuqingSong Mar 20, 2024
a40384e
WIP
juliaroldi Mar 20, 2024
579cd0a
WIP
juliaroldi Mar 21, 2024
0e08c6e
WIP
juliaroldi Mar 21, 2024
dbd24c3
Fix bug in "undoByBackspace" (#2519)
JiuqingSong Mar 21, 2024
3bef91f
Merge branch 'master' of https://github.com/microsoft/roosterjs into …
juliaroldi Mar 21, 2024
ef0a216
Move non-core files from `roosterjs-content-model-core` to `roosterjs…
JiuqingSong Mar 21, 2024
53a1da6
test
juliaroldi Mar 21, 2024
05681e2
WIP
juliaroldi Mar 21, 2024
e3d7027
fixes
juliaroldi Mar 21, 2024
8b909a7
fix test
juliaroldi Mar 21, 2024
e44984a
fix commit
juliaroldi Mar 21, 2024
eaa2280
fixes
juliaroldi Mar 22, 2024
2c22ca8
fix imports
juliaroldi Mar 22, 2024
c6d3934
Merge pull request #2520 from microsoft/u/julairoldi/refactor-auto-fo…
juliaroldi Mar 22, 2024
884e3c9
Prepare publish roosterjs v9 (#2490)
JiuqingSong Mar 22, 2024
ab88e73
auto link
juliaroldi Mar 24, 2024
bd069f8
remove comment
juliaroldi Mar 24, 2024
b91d0f8
Remove a redundant parameter from domToContentModel (#2521)
JiuqingSong Mar 25, 2024
9ce4e62
Merge branch 'master' of https://github.com/microsoft/roosterjs into …
juliaroldi Mar 25, 2024
cfa6326
add space
juliaroldi Mar 25, 2024
2461c80
fix
juliaroldi Mar 25, 2024
90bb28c
Merge branch 'master' into u/juliaroldi/undo-auto-link
juliaroldi Mar 25, 2024
14dbb94
Added iconProp for ContextMenuItem (#2526)
vhuseinova-msft Mar 25, 2024
7f27cda
wip
juliaroldi Mar 25, 2024
9f275aa
Merge branch 'master' into u/juliaroldi/undo-auto-link
juliaroldi Mar 26, 2024
608c1c8
fix test
juliaroldi Mar 26, 2024
042d757
Merge branch 'master' into u/juliaroldi/markdown-plugin-port
juliaroldi Mar 26, 2024
616618c
Do not update the segment format if it have a value when pasting from…
BryanValverdeU Mar 27, 2024
2ef67d7
text
juliaroldi Mar 27, 2024
96d4a3e
Merge branch 'u/juliaroldi/undo-auto-link' of https://github.com/micr…
juliaroldi Mar 27, 2024
fc9d8b7
Fix #2525 (#2530)
JiuqingSong Mar 27, 2024
c76a76e
delete list
juliaroldi Mar 27, 2024
9b855ff
Merge branch 'master' into u/juliaroldi/backspace
juliaroldi Mar 27, 2024
0ce1dc2
Merge pull request #2535 from microsoft/u/juliaroldi/backspace
juliaroldi Mar 27, 2024
22cf37a
split text
juliaroldi Mar 27, 2024
75e3821
Merge branch 'master' into u/juliaroldi/undo-auto-link
juliaroldi Mar 27, 2024
77454eb
Fix exportContent to return the complete editor content even with cus…
florian-msft Mar 27, 2024
ce4d65b
refactor
juliaroldi Mar 28, 2024
2e64c90
disable auto format feature
juliaroldi Mar 28, 2024
a97fb1c
fix url
juliaroldi Mar 28, 2024
d6af272
Merge pull request #2541 from microsoft/u/juliaroldi/disable-auto-for…
juliaroldi Mar 28, 2024
091fdff
conflicts
juliaroldi Mar 28, 2024
2c11a0d
Merge pull request #2522 from microsoft/u/juliaroldi/undo-auto-link
juliaroldi Mar 28, 2024
0f24a6f
Merge branch 'master' of https://github.com/microsoft/roosterjs into …
juliaroldi Mar 28, 2024
20f220d
Bump express from 4.18.2 to 4.19.2 (#2542)
dependabot[bot] Mar 28, 2024
9fde045
Fix 264234 (#2543)
JiuqingSong Mar 28, 2024
ee44e54
Leverage DOMInsertPoint, remove posContainer/offset (#2538)
JiuqingSong Mar 28, 2024
57bb319
fix test
juliaroldi Mar 28, 2024
6a4cda3
refactor
juliaroldi Mar 28, 2024
da48b16
Merge branch 'master' into u/juliaroldi/markdown-plugin-port
juliaroldi Mar 28, 2024
d5d2542
Fix 262677: Allow insert entity to a specified position without chang…
JiuqingSong Mar 28, 2024
731eef8
fix test
juliaroldi Mar 28, 2024
b777796
Fix builddoc script to correctly build document for content model (#2…
JiuqingSong Mar 28, 2024
d4c503b
Fix #2505 (#2545)
JiuqingSong Mar 28, 2024
274e8bf
fix test
juliaroldi Mar 28, 2024
c0198f4
Remove parameter "reduced" from editor.getContentModelCopy (#2539)
JiuqingSong Mar 28, 2024
cc8c4e1
Merge branch 'master' into u/juliaroldi/markdown-plugin-port
juliaroldi Mar 28, 2024
b806329
Set isSelected to false for formatHolder of list item (#2540)
JiuqingSong Mar 28, 2024
3c244e8
fix backspace
juliaroldi Apr 1, 2024
49e00a6
Merge branch 'u/juliaroldi/markdown-plugin-port' of https://github.co…
juliaroldi Apr 1, 2024
3f3eba9
Merge branch 'master' into u/juliaroldi/markdown-plugin-port
juliaroldi Apr 1, 2024
9c41703
Merge pull request #2513 from microsoft/u/juliaroldi/markdown-plugin-…
juliaroldi Apr 1, 2024
d8f0bf0
Improvement of watermark (#2546)
JiuqingSong Apr 1, 2024
7130d12
Fix cache issue (#2547)
JiuqingSong Apr 1, 2024
4d6818b
Merge branch 'master' into u/nguyenvi/versionbump0401
vinguyen12 Apr 1, 2024
511a7bf
version update
vinguyen12 Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,20 @@ module.exports = {
'prefer-const': 'error',
'no-var': 'error',
'etc/no-const-enum': ['error', { allowLocal: true }],
'import/no-default-export': 'error',
},
overrides: [
{
files: [
'roosterjs-editor-*/**/*.ts',
'roosterjs-react/**/*.ts',
'roosterjs-react/**/*.tsx',
'roosterjs-color-utils/**/*.ts',
'roosterjs/**/*.ts',
],
rules: {
'import/no-default-export': 'off',
},
},
],
};
84 changes: 47 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ Rooster is a framework-independent JavaScript rich-text editor neatly nested
inside one HTML `<div>` element. Editing operations performed by end users are
handled in simple ways to generate the final HTML.

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

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

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

Please see [here](https://github.com/microsoft/roosterjs/wiki/RoosterJs-8).
## Upgrade from RoosterJs 8.\*

Please see [here](https://github.com/microsoft/roosterjs/wiki/RoosterJs-9).

## Features

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

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

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

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

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

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

There are also some extension packages to provide additional functionalities.

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

3. [roosterjs-editor-types-compatible](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types_compatible.html):
Provide types that are compatible with isolatedModules mode. When using isolatedModules mode,
"const enum" will not work correctly, this package provides enums with prefix "Compatible" in
their names and they have the same value with const enums in roosterjs-editor-types package
To be compatible with old (8.\*) versions, you can use `EditorAdapter` class from the following package which can act as a 8.\* Editor:

1. [roosterjs-editor-adapter](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_adapter.html):
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))

And the following packages are for old (8.\*) compatibility:

1. [roosterjs-editor-core](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_core.html):
2. [roosterjs-editor-api](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_api.html):
3. [roosterjs-editor-dom](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_dom.html):
4. [roosterjs-editor-plugins](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_plugins.html):
5. [roosterjs-editor-types](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types.html):
6. [roosterjs-editor-types-compatible](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types_compatible.html):

### APIs

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

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

- Perform basic DOM operations such as `wrap()`, `unwrap()`, ...
- Wrap a given DOM node with `InlineElement` or `BlockElement` and perform
operations with DOM Walker API.
- Perform DOM operations on a given scope using scopers.
- Travel among `InlineElements` and `BlockElements` with scope using
ContentTraverser API.
- Create Content Model elements
- Convert DOM tree to Content Model
- Convert Content Model to DOM tree
- Format handlers
- A few DOM level API

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

`roosterjs-editor-api` provides APIs for scenario-based operations triggered by
`roosterjs-content-model-api` provides APIs for scenario-based operations triggered by
user interaction.

## Plugins
Expand All @@ -99,7 +109,7 @@ class HelloRooster implements EditorPlugin {
dispose() {}

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

You can also install sub packages separately:

`yarn add roosterjs-editor-core`
`yarn add roosterjs-content-model-core`

`yarn add roosterjs-editor-api`
`yarn add roosterjs-content-model-api`

`...`

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

## Sample code

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

To build the sample site code yourself, follow these instructions:
To build the demo site code yourself, follow these instructions:

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

Expand Down
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.14.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.14.0/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fluentui-react/8.60.1/fluentui-react.min.js"></script>
<script src="rooster-legacy-min.js"></script>
<script src="rooster-min.js"></script>
<script src="rooster-content-model-min.js"></script>
<script src="rooster-adapter-min.js"></script>
<script src="rooster-react-min.js"></script>
<script src="demo.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions demo/scripts/controls/sidePane/editorOptions/OptionsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const htmlButtons =
'<button id=buttonRedo>Redo</button>\n';
const darkButton = '<button id=buttonDark>Dark Mode</button>\n';
const htmlEnd =
'<script src="https://microsoft.github.io/roosterjs/rooster-min.js"></script>\n' +
'<script src="https://microsoft.github.io/roosterjs/rooster-legacy-min.js"></script>\n' +
'</body>\n' +
'</html>';

Expand All @@ -34,7 +34,7 @@ const htmlRoosterReact =
'<script src="https://unpkg.com/react@16/umd/react.development.js"></script>\n' +
'<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>\n' +
'<script src="https://cdnjs.cloudflare.com/ajax/libs/fluentui-react/8.60.1/fluentui-react.min.js"></script>\n' +
'<script src="https://microsoft.github.io/roosterjs/rooster-min.js"></script>\n' +
'<script src="https://microsoft.github.io/roosterjs/rooster-legacy-min.js"></script>\n' +
'<script src="https://microsoft.github.io/roosterjs/rooster-react-min.js"></script>\n' +
'</body>\n' +
'</html>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import CodeElement from './CodeElement';
import { getObjectKeys } from 'roosterjs-editor-dom';

const codeMap: { [id: string]: string } = {
buttonB: 'roosterjs.toggleBold(editor)',
buttonI: 'roosterjs.toggleItalic(editor)',
buttonU: 'roosterjs.toggleUnderline(editor)',
buttonBullet: 'roosterjs.toggleBullet(editor)',
buttonNumbering: 'roosterjs.toggleNumbering(editor)',
buttonB: 'roosterjsLegacy.toggleBold(editor)',
buttonI: 'roosterjsLegacy.toggleItalic(editor)',
buttonU: 'roosterjsLegacy.toggleUnderline(editor)',
buttonBullet: 'roosterjsLegacy.toggleBullet(editor)',
buttonNumbering: 'roosterjsLegacy.toggleNumbering(editor)',
buttonUndo: 'editor.undo()',
buttonRedo: 'editor.redo()',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default class ContentEditCode extends CodeElement {
}

getCode() {
return 'new roosterjs.ContentEdit(' + this.features.getCode() + ')';
return 'new roosterjsLegacy.ContentEdit(' + this.features.getCode() + ')';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import CodeElement from './CodeElement';

export default class DarkModeCode extends CodeElement {
getCode() {
return 'roosterjs.getDarkColor';
return 'roosterjsLegacy.getDarkColor';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ export default class EditorCode extends CodeElement {
let defaultFormat = this.defaultFormat.getCode();
let expermientalFeatures = this.experimentalFeatures.getCode();
let darkMode = this.darkMode.getCode();
let code = "let contentDiv = document.getElementById('contentDiv') as HTMLDivElement;\n";
let code = "let contentDiv = document.getElementById('contentDiv');\n";
code += `let plugins = ${this.plugins.getCode()};\n`;
code += defaultFormat ? `let defaultFormat: DefaultFormat = ${defaultFormat};\n` : '';
code += 'let options: roosterjs.EditorOptions = {\n';
code += 'let options = {\n';
code += this.indent('plugins: plugins,\n');
code += defaultFormat ? this.indent('defaultFormat: defaultFormat,\n') : '';
code += expermientalFeatures
? this.indent(`experimentalFeatures: [\n${expermientalFeatures}],\n`)
: '';
code += darkMode ? this.indent(`getDarkColor: ${darkMode},\n`) : '';
code += '};\n';
code += 'let editor = new roosterjs.Editor(contentDiv, options);\n';
code += 'let editor = new roosterjsLegacy.Editor(contentDiv, options);\n';
code += this.buttons ? this.buttons.getCode() : '';

return code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class HyperLinkCode extends CodeElement {
}

getCode() {
return 'new roosterjs.HyperLink(' + this.getLinkCallback() + ')';
return 'new roosterjsLegacy.HyperLink(' + this.getLinkCallback() + ')';
}

private getLinkCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import ContentEditCode from './ContentEditCode';
import HyperLinkCode from './HyperLinkCode';
import TableCellSelectionCode from './TableCellSelectionCode';
import WatermarkCode from './WatermarkCode';
import {
CustomReplaceCode,
CutPasteListChainCode,
ImageEditCode,
ContentModelPasteCode,
} from './SimplePluginCode';
import { CustomReplaceCode, CutPasteListChainCode, ImageEditCode } from './SimplePluginCode';

export default class PluginsCode extends CodeElement {
private plugins: CodeElement[];
Expand All @@ -21,7 +16,6 @@ export default class PluginsCode extends CodeElement {
this.plugins = [
pluginList.contentEdit && new ContentEditCode(state.contentEditFeatures),
pluginList.hyperlink && new HyperLinkCode(state.linkTitle),
new ContentModelPasteCode(),
pluginList.watermark && new WatermarkCode(this.state.watermarkText),
pluginList.imageEdit && new ImageEditCode(),
pluginList.cutPasteListChain && new CutPasteListChainCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default class ReactEditorCode extends CodeElement {
}

code += `let plugins = ${this.plugins.getCode()};\n`;
code += defaultFormat ? `let defaultFormat: DefaultFormat = ${defaultFormat};\n` : '';
code += 'let options: roosterjs.EditorOptions = {\n';
code += defaultFormat ? `let defaultFormat = ${defaultFormat};\n` : '';
code += 'let options = {\n';
code += this.indent('plugins: plugins,\n');
code += defaultFormat ? this.indent('defaultFormat: defaultFormat,\n') : '';
code += expermientalFeatures
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CodeElement from './CodeElement';

class SimplePluginCode extends CodeElement {
constructor(private name: string, private namespace: string = 'roosterjs') {
constructor(private name: string, private namespace: string = 'roosterjsLegacy') {
super();
}

Expand All @@ -16,12 +16,6 @@ export class PasteCode extends SimplePluginCode {
}
}

export class ContentModelPasteCode extends SimplePluginCode {
constructor() {
super('PastePlugin', 'roosterjsContentModel');
}
}

export class ImageEditCode extends SimplePluginCode {
constructor() {
super('ImageEdit');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default class TableCellSelectionCode extends CodeElement {
}

getCode() {
return 'new roosterjs.TableCellSelection()';
return 'new roosterjsLegacy.TableCellSelection()';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default class WatermarkCode extends CodeElement {
}

getCode() {
return `new roosterjs.Watermark('${this.encode(this.watermarkText)}')`;
return `new roosterjsLegacy.Watermark('${this.encode(this.watermarkText)}')`;
}
}
5 changes: 5 additions & 0 deletions demo/scripts/controlsV2/demoButtons/darkModeButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ export const darkModeButton: RibbonButton<DarkModeButtonStringKey> = {
MainPane.getInstance().toggleDarkMode();
return true;
},
commandBarProperties: {
buttonStyles: {
icon: { paddingBottom: '10px' },
},
},
};
5 changes: 5 additions & 0 deletions demo/scripts/controlsV2/demoButtons/exportContentButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ export const exportContentButton: RibbonButton<ExportButtonStringKey> = {
const html = exportContent(editor);
win.document.write(editor.getTrustedHTMLHandler()(html));
},
commandBarProperties: {
buttonStyles: {
icon: { paddingBottom: '10px' },
},
},
};
22 changes: 13 additions & 9 deletions demo/scripts/controlsV2/demoButtons/formatPainterButton.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { FormatPainterPlugin } from '../plugins/FormatPainterPlugin';
import { FormatPainterHandler } from '../plugins/FormatPainterPlugin';
import type { RibbonButton } from '../roosterjsReact/ribbon';

/**
* @internal
* "Format Painter" button on the format ribbon
*/
export const formatPainterButton: RibbonButton<'formatPainter'> = {
key: 'formatPainter',
unlocalizedText: 'Format painter',
iconName: 'Brush',
onClick: () => {
FormatPainterPlugin.startFormatPainter();
},
};
export function createFormatPainterButton(
handler: FormatPainterHandler
): RibbonButton<'formatPainter'> {
return {
key: 'formatPainter',
unlocalizedText: 'Format painter',
iconName: 'Brush',
onClick: () => {
handler.startFormatPainter();
},
};
}
2 changes: 1 addition & 1 deletion demo/scripts/controlsV2/demoButtons/formatTableButton.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatTable } from 'roosterjs-content-model-api';
import { TableBorderFormat } from 'roosterjs-content-model-core';
import { TableBorderFormat } from 'roosterjs-content-model-dom';
import { TableMetadataFormat } from 'roosterjs-content-model-types';
import type { RibbonButton } from '../roosterjsReact/ribbon';

Expand Down
3 changes: 2 additions & 1 deletion demo/scripts/controlsV2/demoButtons/pasteButton.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extractClipboardItems, paste } from 'roosterjs-content-model-core';
import { extractClipboardItems } from 'roosterjs-content-model-dom';
import { paste } from 'roosterjs-content-model-core';
import type { RibbonButton } from '../roosterjsReact/ribbon';

/**
Expand Down
Loading
Loading