Skip to content

Commit fb93567

Browse files
Andres-CT98juliaroldilcganiJiuqingSongBryanValverdeU
authored
Version bump content model packages to 0.25.0 (#2392)
* wip * wip * refactor * fix dependecies * fix dependecies * fix dependecies * WIP * add test * add tests * types * add comment * add comment * add comment * add comment * add comment * comments * fix build * fixes * fixes * refactor * fixes * Add shortcut support Ctrl+K for insertLink (#2333) * Add shortcut support Ctrl+K for insertLink * Add metakey and alt key checks * Add insertButton check and disable param * add options to ribbon and decouple onButtonClick * update * update fix * add break statement * remove duplicate imports --------- Co-authored-by: Ghanem10 <107857762+Ghanem10@users.noreply.github.com> Co-authored-by: Jiuqing Song <jisong@microsoft.com> * Content Model: Add back ContentModelBeforePasteEvent (#2347) * Use margin-top and bottom for list margin (#2346) * Standalone Editor: Improve cache (3rd try) (#2344) Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com> * fixes * fix test * Fix safari selection issue (#2332) * try fix safari selection issue * fix content model editor, add test * fix focus bug * Standalone Editor: Remove dependency to old code from api and plugins package (#2349) * Content Model: Decouple test code from old code (#2351) * Fix demo site (#2353) * Content Model: Fix table text color (#2359) * Fix pending format (#2354) * Fix pending format * improve * Standalone Editor: Provide a DOMHelper to allow access DOM tree (#2363) * Fix shadow edit (#2355) * Fix 2 shadow edit issue (#2356) * Support unit "inch" when parse value (#2357) * Content Model: Support inch when parse unit value * add comment * Code clean up: small refactor to paste code (#2365) * Refactor paste * add test * Code clean up: Remove IStandaloneEditor.setContentModel (#2364) * Add support to cursor around Block entities. (#2350) * rotator space * Port ContextMenu plugin (#2366) * Port ContextMenu plugin * add test * Content Model: Fix 252436 (#2367) * Content Model: Fix 252436 * add test --------- Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com> * Code cleanup: Remove parameter onNodeCreated (#2374) * Code cleanup: Remove isContentModelEditor (#2371) * Code cleanup: Remove isContentModelEditor * add buttons * Add `isReverted` to DOM Selection (#2368) * add Changes * add Tests * fix dependencies * address comments * address comment * fix after merge * fix test --------- Co-authored-by: Jiuqing Song <jisong@microsoft.com> * Code cleanup: Remove NormalizeTablePlugin (#2376) * add normalize content model * fix build * Code cleanup: Replace createContentModel with getContentModelCopy (#2372) * Code cleanup: Remove isContentModelEditor * add buttons * Code cleanup: Replace createContentModel with getContentModelCopy * Code cleanup: Remove get/setZoomScale (#2378) * Code cleanup: Remove get/setZoomScale * Add calculateZoomScale function * improve * Code cleanup: Move isNodeInEditor into DOMHelper (#2379) * Code cleanup: Remove TODO (#2384) * Add write permission to deploy action (#2383) * Revert "Add support to cursor around Block entities. (#2350)" (#2390) This reverts commit 7998d03. * Content Model: Fix #2202 (#2389) Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com> * bump --------- Co-authored-by: Júlia Roldi <juliaroldi@microsoft.com> Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com> Co-authored-by: Gani <107857762+gm-al@users.noreply.github.com> Co-authored-by: Ghanem10 <107857762+Ghanem10@users.noreply.github.com> Co-authored-by: Jiuqing Song <jisong@microsoft.com> Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>
1 parent 56194db commit fb93567

File tree

197 files changed

+6944
-2947
lines changed

Some content is hidden

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

197 files changed

+6944
-2947
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
jobs:
77
build-and-deploy:
88
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
911
steps:
1012
- name: Checkout
1113
uses: actions/checkout@v2.3.1

demo/scripts/controls/ContentModelEditorMainPane.tsx

Lines changed: 143 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ContentModelEventViewPlugin from './sidePane/eventViewer/ContentModelEven
66
import ContentModelFormatPainterPlugin from './contentModel/plugins/ContentModelFormatPainterPlugin';
77
import ContentModelFormatStatePlugin from './sidePane/formatState/ContentModelFormatStatePlugin';
88
import ContentModelPanePlugin from './sidePane/contentModel/ContentModelPanePlugin';
9-
import ContentModelRibbon from './ribbonButtons/contentModel/ContentModelRibbon';
9+
import ContentModelRibbonButton from './ribbonButtons/contentModel/ContentModelRibbonButton';
1010
import ContentModelRooster from './contentModel/editor/ContentModelRooster';
1111
import ContentModelSnapshotPlugin from './sidePane/snapshot/ContentModelSnapshotPlugin';
1212
import getToggleablePlugins from './getToggleablePlugins';
@@ -15,18 +15,86 @@ import RibbonPlugin from './ribbonButtons/contentModel/RibbonPlugin';
1515
import SampleEntityPlugin from './sampleEntity/SampleEntityPlugin';
1616
import SidePane from './sidePane/SidePane';
1717
import TitleBar from './titleBar/TitleBar';
18+
import { alignCenterButton } from './ribbonButtons/contentModel/alignCenterButton';
19+
import { alignJustifyButton } from './ribbonButtons/contentModel/alignJustifyButton';
20+
import { alignLeftButton } from './ribbonButtons/contentModel/alignLeftButton';
21+
import { alignRightButton } from './ribbonButtons/contentModel/alignRightButton';
1822
import { arrayPush } from 'roosterjs-editor-dom';
23+
import { backgroundColorButton } from './ribbonButtons/contentModel/backgroundColorButton';
24+
import { blockQuoteButton } from './ribbonButtons/contentModel/blockQuoteButton';
25+
import { boldButton } from './ribbonButtons/contentModel/boldButton';
26+
import { bulletedListButton } from './ribbonButtons/contentModel/bulletedListButton';
27+
import { changeImageButton } from './ribbonButtons/contentModel/changeImageButton';
28+
import { clearFormatButton } from './ribbonButtons/contentModel/clearFormatButton';
29+
import { codeButton } from './ribbonButtons/contentModel/codeButton';
30+
import { ContentModelRibbon } from './ribbonButtons/contentModel/ContentModelRibbon';
1931
import { ContentModelRibbonPlugin } from './ribbonButtons/contentModel/ContentModelRibbonPlugin';
2032
import { ContentModelSegmentFormat, Snapshots } from 'roosterjs-content-model-types';
2133
import { createEmojiPlugin, createPasteOptionPlugin } from 'roosterjs-react';
34+
import { darkMode } from './ribbonButtons/contentModel/darkMode';
35+
import { decreaseFontSizeButton } from './ribbonButtons/contentModel/decreaseFontSizeButton';
36+
import { decreaseIndentButton } from './ribbonButtons/contentModel/decreaseIndentButton';
2237
import { EditorPlugin } from 'roosterjs-editor-types';
38+
import { exportContent } from './ribbonButtons/contentModel/export';
39+
import { fontButton } from './ribbonButtons/contentModel/fontButton';
40+
import { fontSizeButton } from './ribbonButtons/contentModel/fontSizeButton';
41+
import { formatPainterButton } from './ribbonButtons/contentModel/formatPainterButton';
42+
import { formatTableButton } from './ribbonButtons/contentModel/formatTableButton';
2343
import { getDarkColor } from 'roosterjs-color-utils';
44+
import { imageBorderColorButton } from './ribbonButtons/contentModel/imageBorderColorButton';
45+
import { imageBorderRemoveButton } from './ribbonButtons/contentModel/imageBorderRemoveButton';
46+
import { imageBorderStyleButton } from './ribbonButtons/contentModel/imageBorderStyleButton';
47+
import { imageBorderWidthButton } from './ribbonButtons/contentModel/imageBorderWidthButton';
48+
import { imageBoxShadowButton } from './ribbonButtons/contentModel/imageBoxShadowButton';
49+
import { increaseFontSizeButton } from './ribbonButtons/contentModel/increaseFontSizeButton';
50+
import { increaseIndentButton } from './ribbonButtons/contentModel/increaseIndentButton';
51+
import { insertImageButton } from './ribbonButtons/contentModel/insertImageButton';
52+
import { insertLinkButton } from './ribbonButtons/contentModel/insertLinkButton';
53+
import { insertTableButton } from './ribbonButtons/contentModel/insertTableButton';
54+
import { italicButton } from './ribbonButtons/contentModel/italicButton';
55+
import { listStartNumberButton } from './ribbonButtons/contentModel/listStartNumberButton';
56+
import { ltrButton } from './ribbonButtons/contentModel/ltrButton';
57+
import { numberedListButton } from './ribbonButtons/contentModel/numberedListButton';
2458
import { PartialTheme } from '@fluentui/react/lib/Theme';
59+
import { pasteButton } from './ribbonButtons/contentModel/pasteButton';
60+
import { popout } from './ribbonButtons/contentModel/popout';
61+
import { redoButton } from './ribbonButtons/contentModel/redoButton';
62+
import { removeLinkButton } from './ribbonButtons/contentModel/removeLinkButton';
63+
import { rtlButton } from './ribbonButtons/contentModel/rtlButton';
64+
import { setBulletedListStyleButton } from './ribbonButtons/contentModel/setBulletedListStyleButton';
65+
import { setHeadingLevelButton } from './ribbonButtons/contentModel/setHeadingLevelButton';
66+
import { setNumberedListStyleButton } from './ribbonButtons/contentModel/setNumberedListStyleButton';
67+
import { setTableCellShadeButton } from './ribbonButtons/contentModel/setTableCellShadeButton';
68+
import { setTableHeaderButton } from './ribbonButtons/contentModel/setTableHeaderButton';
69+
import { spacingButton } from './ribbonButtons/contentModel/spacingButton';
70+
import { strikethroughButton } from './ribbonButtons/contentModel/strikethroughButton';
71+
import { subscriptButton } from './ribbonButtons/contentModel/subscriptButton';
72+
import { superscriptButton } from './ribbonButtons/contentModel/superscriptButton';
73+
import { tableBorderApplyButton } from './ribbonButtons/contentModel/tableBorderApplyButton';
74+
import { tableBorderColorButton } from './ribbonButtons/contentModel/tableBorderColorButton';
75+
import { tableBorderStyleButton } from './ribbonButtons/contentModel/tableBorderStyleButton';
76+
import { tableBorderWidthButton } from './ribbonButtons/contentModel/tableBorderWidthButton';
77+
import { textColorButton } from './ribbonButtons/contentModel/textColorButton';
2578
import { trustedHTMLHandler } from '../utils/trustedHTMLHandler';
79+
import { underlineButton } from './ribbonButtons/contentModel/underlineButton';
80+
import { undoButton } from './ribbonButtons/contentModel/undoButton';
81+
import { zoom } from './ribbonButtons/contentModel/zoom';
2682
import {
83+
spaceAfterButton,
84+
spaceBeforeButton,
85+
} from './ribbonButtons/contentModel/spaceBeforeAfterButtons';
86+
import {
87+
tableAlignCellButton,
88+
tableAlignTableButton,
89+
tableDeleteButton,
90+
tableInsertButton,
91+
tableMergeButton,
92+
tableSplitButton,
93+
} from './ribbonButtons/contentModel/tableEditButtons';
94+
import {
95+
ContentModelAutoFormatPlugin,
2796
ContentModelEditPlugin,
2897
ContentModelPastePlugin,
29-
EntityDelimiterPlugin,
3098
} from 'roosterjs-content-model-plugins';
3199
import {
32100
ContentModelEditor,
@@ -101,16 +169,80 @@ class ContentModelEditorMainPane extends MainPaneBase<ContentModelMainPaneState>
101169
private apiPlaygroundPlugin: ApiPlaygroundPlugin;
102170
private contentModelPanePlugin: ContentModelPanePlugin;
103171
private contentModelEditPlugin: ContentModelEditPlugin;
172+
private contentModelAutoFormatPlugin: ContentModelAutoFormatPlugin;
104173
private contentModelRibbonPlugin: RibbonPlugin;
105174
private pasteOptionPlugin: EditorPlugin;
106175
private emojiPlugin: EditorPlugin;
107176
private snapshotPlugin: ContentModelSnapshotPlugin;
108-
private entityDelimiterPlugin: EntityDelimiterPlugin;
109177
private toggleablePlugins: EditorPlugin[] | null = null;
110178
private formatPainterPlugin: ContentModelFormatPainterPlugin;
111179
private pastePlugin: ContentModelPastePlugin;
112180
private sampleEntityPlugin: SampleEntityPlugin;
113181
private snapshots: Snapshots;
182+
private buttons: ContentModelRibbonButton<any>[] = [
183+
formatPainterButton,
184+
boldButton,
185+
italicButton,
186+
underlineButton,
187+
fontButton,
188+
fontSizeButton,
189+
increaseFontSizeButton,
190+
decreaseFontSizeButton,
191+
textColorButton,
192+
backgroundColorButton,
193+
bulletedListButton,
194+
numberedListButton,
195+
decreaseIndentButton,
196+
increaseIndentButton,
197+
blockQuoteButton,
198+
alignLeftButton,
199+
alignCenterButton,
200+
alignRightButton,
201+
alignJustifyButton,
202+
insertLinkButton,
203+
removeLinkButton,
204+
insertTableButton,
205+
insertImageButton,
206+
superscriptButton,
207+
subscriptButton,
208+
strikethroughButton,
209+
setHeadingLevelButton,
210+
codeButton,
211+
ltrButton,
212+
rtlButton,
213+
undoButton,
214+
redoButton,
215+
clearFormatButton,
216+
setBulletedListStyleButton,
217+
setNumberedListStyleButton,
218+
listStartNumberButton,
219+
formatTableButton,
220+
setTableCellShadeButton,
221+
setTableHeaderButton,
222+
tableInsertButton,
223+
tableDeleteButton,
224+
tableMergeButton,
225+
tableSplitButton,
226+
tableAlignCellButton,
227+
tableAlignTableButton,
228+
tableBorderApplyButton,
229+
tableBorderColorButton,
230+
tableBorderWidthButton,
231+
tableBorderStyleButton,
232+
imageBorderColorButton,
233+
imageBorderWidthButton,
234+
imageBorderStyleButton,
235+
imageBorderRemoveButton,
236+
changeImageButton,
237+
imageBoxShadowButton,
238+
spacingButton,
239+
spaceBeforeButton,
240+
spaceAfterButton,
241+
pasteButton,
242+
darkMode,
243+
zoom,
244+
exportContent,
245+
];
114246

115247
constructor(props: {}) {
116248
super(props);
@@ -130,10 +262,10 @@ class ContentModelEditorMainPane extends MainPaneBase<ContentModelMainPaneState>
130262
this.snapshotPlugin = new ContentModelSnapshotPlugin(this.snapshots);
131263
this.contentModelPanePlugin = new ContentModelPanePlugin();
132264
this.contentModelEditPlugin = new ContentModelEditPlugin();
265+
this.contentModelAutoFormatPlugin = new ContentModelAutoFormatPlugin();
133266
this.contentModelRibbonPlugin = new ContentModelRibbonPlugin();
134267
this.pasteOptionPlugin = createPasteOptionPlugin();
135268
this.emojiPlugin = createEmojiPlugin();
136-
this.entityDelimiterPlugin = new EntityDelimiterPlugin();
137269
this.formatPainterPlugin = new ContentModelFormatPainterPlugin();
138270
this.pastePlugin = new ContentModelPastePlugin();
139271
this.sampleEntityPlugin = new SampleEntityPlugin();
@@ -162,11 +294,13 @@ class ContentModelEditorMainPane extends MainPaneBase<ContentModelMainPaneState>
162294
}
163295

164296
renderRibbon(isPopout: boolean) {
297+
const buttons = isPopout ? this.buttons : this.buttons.concat([popout]);
298+
165299
return (
166300
<ContentModelRibbon
167-
ribbonPlugin={this.contentModelRibbonPlugin}
168-
isRtl={this.state.isRtl}
169-
isInPopout={isPopout}
301+
buttons={buttons}
302+
plugin={this.contentModelRibbonPlugin}
303+
dir={this.state.isRtl ? 'rtl' : 'ltr'}
170304
/>
171305
);
172306
}
@@ -192,10 +326,8 @@ class ContentModelEditorMainPane extends MainPaneBase<ContentModelMainPaneState>
192326

193327
const plugins = [
194328
...this.toggleablePlugins,
195-
this.contentModelPanePlugin.getInnerRibbonPlugin(),
196329
this.pasteOptionPlugin,
197330
this.emojiPlugin,
198-
this.entityDelimiterPlugin,
199331
this.sampleEntityPlugin,
200332
];
201333

@@ -254,15 +386,16 @@ class ContentModelEditorMainPane extends MainPaneBase<ContentModelMainPaneState>
254386
this.contentModelRibbonPlugin,
255387
this.formatPainterPlugin,
256388
this.pastePlugin,
389+
this.contentModelAutoFormatPlugin,
257390
this.contentModelEditPlugin,
391+
this.contentModelPanePlugin.getInnerRibbonPlugin(),
258392
]}
259393
defaultSegmentFormat={defaultFormat}
260394
inDarkMode={this.state.isDarkMode}
261395
getDarkColor={getDarkColor}
262396
experimentalFeatures={this.state.initState.experimentalFeatures}
263397
snapshots={this.snapshotPlugin.getSnapshots()}
264398
trustedHTMLHandler={trustedHTMLHandler}
265-
zoomScale={this.state.scale}
266399
initialContent={this.content}
267400
editorCreator={this.state.editorCreator}
268401
dir={this.state.isRtl ? 'rtl' : 'ltr'}

0 commit comments

Comments
 (0)