Skip to content

Commit e2ae751

Browse files
Andres-CT98JiuqingSongBryanValverdeUjuliaroldi
authored
Version bump 8.54.0 (#2042)
* Content Model: Improve cache behavior (#1999) * Content Model: Improve cache behavior * fix build * fix comment * Skip Trigger plugin event on plain text paste (#2011) * init * remove unneeded change * Update return type * Fix 218869: Do not allow dragging on readonly content (#2010) * Fix 218869: Do not allow dragging readonly content * fix test * Content Model: Fix 194024 and 220289 (#2012) * Content Model: Fix 221290 Support float for image (#2013) * Content Model: improve formatWithContentModel 1 (#2001) * Content Model: Improve cache behavior * fix build * Content Model: improve formatWithContentModel * Content Model: improve formatWithContentModel 2 (#2002) * Content Model: Improve cache behavior * fix build * Content Model: improve formatWithContentModel * Content Model: improve formatWithContentModel 2 * fix format * WIP * fix handles * MergeModel, do not inherit the styles of table when splitting the param (#2016) * init * init * address comment * update test names * fixes * Demo site: Fix insert link button in Content Model ribbon (#2018) * Content Model: insertEntity API (#1800) * Content Model insertEntity * improve * improve * Content Model: Improve cache behavior * fix build * Content Model: improve formatWithContentModel * Content Model: improve formatWithContentModel 2 * Improve * fix build * fix build * improve * add test * add test * add test * add test * fix dark color * fix test * fix build and test * crop * fix xase * check cell exist * Fix #1752, rename header to heading (#2020) * fix cell empty cells * fix flipped image * Update logic to decide if we need to merge a table on paste. (#2022) * Fix TableSelectionCopy * update unit tests * Fix 2 * address comment * Content Model: Rename a test file (#2029) * Fix Triple clicking a single cell selecting more than one (#2024) * fix triple click, optimisation * Remove `display: flex` style on paste (#2031) * init * Fix * Replace first cell content if input while on cell selection (#2030) * select first cell content and empty, add undo if change * Content Model: Fix 222135 (#2035) * Fix 222135 * fix build * Content Model: Fix 219312 (#2036) * Fix regression when creating the BeforePasteEvent (#2039) * init * fix build * Content Model: Fix 220050 (#2037) * Content Model: Fix 220050 * Fix build * improve * improve * Simplify the domToModel call in `paste.ts` (#2040) * add more changes * fix build * fix test * Content Model: Support vertical-align for image (#2041) * Content Model: Support vertical-align for image * fix build and test --------- Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com> * version bump --------- Co-authored-by: Jiuqing Song <jisong@microsoft.com> Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com> Co-authored-by: Júlia Roldi <juliaroldi@microsoft.com> Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com>
1 parent fc1c8bc commit e2ae751

165 files changed

Lines changed: 6813 additions & 2216 deletions

File tree

Some content is hidden

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

demo/scripts/controls/ContentModelEditorMainPane.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import * as ReactDOM from 'react-dom';
3-
import ApiPlaygroundPlugin from './sidePane/apiPlayground/ApiPlaygroundPlugin';
3+
import ApiPlaygroundPlugin from './sidePane/contentModelApiPlayground/ApiPlaygroundPlugin';
44
import ContentModelEditorOptionsPlugin from './sidePane/editorOptions/ContentModelEditorOptionsPlugin';
55
import ContentModelFormatPainterPlugin from './contentModel/plugins/ContentModelFormatPainterPlugin';
66
import ContentModelFormatStatePlugin from './sidePane/formatState/ContentModelFormatStatePlugin';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { createTextFormatRenderer } from '../utils/createTextFormatRenderer';
2+
import { FloatFormat } from 'roosterjs-content-model-types';
3+
import { FormatRenderer } from '../utils/FormatRenderer';
4+
5+
export const FloatFormatRenderer: FormatRenderer<FloatFormat> = createTextFormatRenderer<
6+
FloatFormat
7+
>(
8+
'Float',
9+
format => format.float,
10+
(format, value) => (format.float = value)
11+
);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ContentModelCodeView } from './ContentModelCodeView';
33
import { ContentModelImage, ContentModelImageFormat } from 'roosterjs-content-model-types';
44
import { ContentModelLinkView } from './ContentModelLinkView';
55
import { ContentModelView } from '../ContentModelView';
6+
import { FloatFormatRenderer } from '../format/formatPart/FloatFormatRenderer';
67
import { FormatRenderer } from '../format/utils/FormatRenderer';
78
import { FormatView } from '../format/FormatView';
89
import { IdFormatRenderer } from '../format/formatPart/IdFormatRenderer';
@@ -22,6 +23,7 @@ const ImageFormatRenderers: FormatRenderer<ContentModelImageFormat>[] = [
2223
...SizeFormatRenderers,
2324
MarginFormatRenderer,
2425
PaddingFormatRenderer,
26+
FloatFormatRenderer,
2527
];
2628

2729
export function ContentModelImageView(props: { image: ContentModelImage }) {

demo/scripts/controls/contentModel/plugins/ContentModelFormatPainterPlugin.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ContentModelSegmentFormat } from 'roosterjs-content-model-types';
22
import { EditorPlugin, IEditor, PluginEvent, PluginEventType } from 'roosterjs-editor-types';
33
import {
44
applySegmentFormat,
5-
getSegmentFormat,
5+
getFormatState,
66
IContentModelEditor,
77
} from 'roosterjs-content-model-editor';
88

@@ -53,13 +53,13 @@ export default class ContentModelFormatPainterPlugin implements EditorPlugin {
5353
}
5454
}
5555

56-
function getFormatHolder(editor: IEditor): FormatPainterFormatHolder {
56+
function getFormatHolder(editor: IContentModelEditor): FormatPainterFormatHolder {
5757
return editor.getCustomData('__FormatPainterFormat', () => {
5858
return {} as FormatPainterFormatHolder;
5959
});
6060
}
6161

62-
function setFormatPainterCursor(editor: IEditor, isOn: boolean) {
62+
function setFormatPainterCursor(editor: IContentModelEditor, isOn: boolean) {
6363
let styles = editor.getEditorDomAttribute('style') || '';
6464
styles = styles.replace(CURSOR_REGEX, '');
6565

@@ -69,3 +69,24 @@ function setFormatPainterCursor(editor: IEditor, isOn: boolean) {
6969

7070
editor.setEditorDomAttribute('style', styles);
7171
}
72+
73+
function getSegmentFormat(editor: IContentModelEditor): ContentModelSegmentFormat {
74+
const formatState = getFormatState(editor);
75+
76+
return {
77+
backgroundColor: formatState.backgroundColor,
78+
fontFamily: formatState.fontName,
79+
fontSize: formatState.fontSize,
80+
fontWeight: formatState.isBold ? 'bold' : 'normal',
81+
italic: formatState.isItalic,
82+
letterSpacing: formatState.letterSpacing,
83+
strikethrough: formatState.isStrikeThrough,
84+
superOrSubScriptSequence: formatState.isSubscript
85+
? 'sub'
86+
: formatState.isSuperscript
87+
? 'super'
88+
: '',
89+
textColor: formatState.textColor,
90+
underline: formatState.isUnderline,
91+
};
92+
}

demo/scripts/controls/ribbonButtons/contentModel/ContentModelRibbon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { removeLinkButton } from './removeLinkButton';
3737
import { Ribbon, RibbonButton, RibbonPlugin } from 'roosterjs-react';
3838
import { rtlButton } from './rtlButton';
3939
import { setBulletedListStyleButton } from './setBulletedListStyleButton';
40-
import { setHeaderLevelButton } from './setHeaderLevelButton';
40+
import { setHeadingLevelButton } from './setHeadingLevelButton';
4141
import { setNumberedListStyleButton } from './setNumberedListStyleButton';
4242
import { setTableCellShadeButton } from './setTableCellShadeButton';
4343
import { setTableHeaderButton } from './setTableHeaderButton';
@@ -84,7 +84,7 @@ const buttons = [
8484
superscriptButton,
8585
subscriptButton,
8686
strikethroughButton,
87-
setHeaderLevelButton,
87+
setHeadingLevelButton,
8888
codeButton,
8989
ltrButton,
9090
rtlButton,

demo/scripts/controls/ribbonButtons/contentModel/ContentModelRibbonPlugin.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import { FormatState, PluginEvent, PluginEventType } from 'roosterjs-editor-types';
2-
import { getFormatState, IContentModelEditor } from 'roosterjs-content-model-editor';
31
import { getObjectKeys } from 'roosterjs-editor-dom';
42
import { LocalizedStrings, RibbonButton, RibbonPlugin, UIUtilities } from 'roosterjs-react';
3+
import { PluginEvent, PluginEventType } from 'roosterjs-editor-types';
4+
import {
5+
ContentModelFormatState,
6+
getFormatState,
7+
IContentModelEditor,
8+
} from 'roosterjs-content-model-editor';
59

610
export class ContentModelRibbonPlugin implements RibbonPlugin {
711
private editor: IContentModelEditor | null = null;
8-
private onFormatChanged: ((formatState: FormatState) => void) | null = null;
12+
private onFormatChanged: ((formatState: ContentModelFormatState) => void) | null = null;
913
private timer = 0;
10-
private formatState: FormatState | null = null;
14+
private formatState: ContentModelFormatState | null = null;
1115
private uiUtilities: UIUtilities | null = null;
1216

1317
/**
@@ -68,7 +72,7 @@ export class ContentModelRibbonPlugin implements RibbonPlugin {
6872
/**
6973
* Register a callback to be invoked when format state of editor is changed, returns a disposer function.
7074
*/
71-
registerFormatChangedCallback(callback: (formatState: FormatState) => void) {
75+
registerFormatChangedCallback(callback: (formatState: ContentModelFormatState) => void) {
7276
this.onFormatChanged = callback;
7377

7478
return () => {

demo/scripts/controls/ribbonButtons/contentModel/insertLinkButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import showInputDialog from 'roosterjs-react/lib/inputDialog/utils/showInputDialog';
21
import { InsertLinkButtonStringKey, RibbonButton } from 'roosterjs-react';
2+
import { showInputDialog } from 'roosterjs-react/lib/inputDialog';
33
import {
44
adjustLinkSelection,
55
insertLink,

demo/scripts/controls/ribbonButtons/contentModel/setHeaderLevelButton.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { isContentModelEditor, setHeadingLevel } from 'roosterjs-content-model-editor';
2+
import {
3+
getButtons,
4+
HeadingButtonStringKey,
5+
KnownRibbonButtonKey,
6+
RibbonButton,
7+
} from 'roosterjs-react';
8+
9+
const originalHeadingButton: RibbonButton<HeadingButtonStringKey> = getButtons([
10+
KnownRibbonButtonKey.Heading,
11+
])[0] as RibbonButton<HeadingButtonStringKey>;
12+
const keys: HeadingButtonStringKey[] = [
13+
'buttonNameNoHeading',
14+
'buttonNameHeading1',
15+
'buttonNameHeading2',
16+
'buttonNameHeading3',
17+
'buttonNameHeading4',
18+
'buttonNameHeading5',
19+
'buttonNameHeading6',
20+
];
21+
22+
export const setHeadingLevelButton: RibbonButton<HeadingButtonStringKey> = {
23+
dropDownMenu: {
24+
...originalHeadingButton.dropDownMenu,
25+
},
26+
key: 'buttonNameHeading',
27+
unlocalizedText: 'Heading',
28+
iconName: 'Header1',
29+
onClick: (editor, key) => {
30+
const headingLevel = keys.indexOf(key);
31+
32+
if (isContentModelEditor(editor) && headingLevel >= 0) {
33+
setHeadingLevel(editor, headingLevel as 0 | 1 | 2 | 3 | 4 | 5 | 6);
34+
}
35+
},
36+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { IEditor, PluginEvent } from 'roosterjs-editor-types';
2+
import { SidePaneElementProps } from '../SidePaneElement';
3+
4+
export default interface ApiPaneProps extends SidePaneElementProps {
5+
getEditor: () => IEditor;
6+
}
7+
8+
export interface ApiPlaygroundComponent {
9+
onPluginEvent?: (e: PluginEvent) => void;
10+
}

0 commit comments

Comments
 (0)