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

Version bump 8.54.0 #2042

Merged
merged 41 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d6a390c
Content Model: Improve cache behavior (#1999)
JiuqingSong Aug 4, 2023
795c00d
Skip Trigger plugin event on plain text paste (#2011)
BryanValverdeU Aug 8, 2023
4680506
Fix 218869: Do not allow dragging on readonly content (#2010)
JiuqingSong Aug 8, 2023
aa49e67
Content Model: Fix 194024 and 220289 (#2012)
JiuqingSong Aug 8, 2023
e8d2536
Content Model: Fix 221290 Support float for image (#2013)
JiuqingSong Aug 8, 2023
6eecbc7
Content Model: improve formatWithContentModel 1 (#2001)
JiuqingSong Aug 8, 2023
991fed1
Content Model: improve formatWithContentModel 2 (#2002)
JiuqingSong Aug 9, 2023
0ea0095
WIP
juliaroldi Aug 9, 2023
be1ffcb
fix handles
juliaroldi Aug 9, 2023
84e8f2e
Merge branch 'master' into u/juliaroldi/image-bugs-part-2
juliaroldi Aug 9, 2023
72f0c87
MergeModel, do not inherit the styles of table when splitting the par…
BryanValverdeU Aug 9, 2023
ce9f802
fixes
juliaroldi Aug 9, 2023
410bfbd
Merge branch 'master' into u/juliaroldi/image-bugs-part-2
juliaroldi Aug 10, 2023
a1a7b81
Demo site: Fix insert link button in Content Model ribbon (#2018)
JiuqingSong Aug 10, 2023
349d30a
Merge branch 'master' into u/juliaroldi/image-bugs-part-2
juliaroldi Aug 10, 2023
69005d6
Merge pull request #2017 from microsoft/u/juliaroldi/image-bugs-part-2
juliaroldi Aug 10, 2023
a8a9592
Content Model: insertEntity API (#1800)
JiuqingSong Aug 11, 2023
dec835d
crop
juliaroldi Aug 11, 2023
f44cc25
fix xase
juliaroldi Aug 11, 2023
7731317
Merge pull request #2019 from microsoft/u/juliaroldi/cropper
juliaroldi Aug 11, 2023
4d37ad2
check cell exist
juliaroldi Aug 11, 2023
7e722e5
Fix #1752, rename header to heading (#2020)
JiuqingSong Aug 11, 2023
06736fa
fix cell empty cells
juliaroldi Aug 14, 2023
0c6f947
Merge branch 'master' into u/juliaroldi/empty-cells
juliaroldi Aug 14, 2023
a417d9e
Merge pull request #2027 from microsoft/u/juliaroldi/empty-cells
juliaroldi Aug 14, 2023
6d610cd
fix flipped image
juliaroldi Aug 14, 2023
a4f0941
Merge branch 'master' into u/juliaroldi/image-flipped
juliaroldi Aug 14, 2023
e1a5c28
Merge pull request #2028 from microsoft/u/juliaroldi/image-flipped
juliaroldi Aug 14, 2023
a2b9804
Update logic to decide if we need to merge a table on paste. (#2022)
BryanValverdeU Aug 15, 2023
ce15217
Content Model: Rename a test file (#2029)
JiuqingSong Aug 15, 2023
560db30
Fix Triple clicking a single cell selecting more than one (#2024)
Andres-CT98 Aug 15, 2023
8c7fa2b
Remove `display: flex` style on paste (#2031)
BryanValverdeU Aug 16, 2023
f03f701
Replace first cell content if input while on cell selection (#2030)
Andres-CT98 Aug 17, 2023
2875a23
Content Model: Fix 222135 (#2035)
JiuqingSong Aug 17, 2023
14386b6
Content Model: Fix 219312 (#2036)
JiuqingSong Aug 17, 2023
8a200e7
Fix regression when creating the BeforePasteEvent (#2039)
BryanValverdeU Aug 18, 2023
dbf5617
Content Model: Fix 220050 (#2037)
JiuqingSong Aug 18, 2023
665ab68
Simplify the domToModel call in `paste.ts` (#2040)
BryanValverdeU Aug 18, 2023
7c6a320
Content Model: Support vertical-align for image (#2041)
JiuqingSong Aug 18, 2023
ce9adea
version bump
Andres-CT98 Aug 18, 2023
f74541f
Merge branch 'release' into version-bump-8.54.0
Andres-CT98 Aug 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/scripts/controls/ContentModelEditorMainPane.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import ApiPlaygroundPlugin from './sidePane/apiPlayground/ApiPlaygroundPlugin';
import ApiPlaygroundPlugin from './sidePane/contentModelApiPlayground/ApiPlaygroundPlugin';
import ContentModelEditorOptionsPlugin from './sidePane/editorOptions/ContentModelEditorOptionsPlugin';
import ContentModelFormatPainterPlugin from './contentModel/plugins/ContentModelFormatPainterPlugin';
import ContentModelFormatStatePlugin from './sidePane/formatState/ContentModelFormatStatePlugin';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createTextFormatRenderer } from '../utils/createTextFormatRenderer';
import { FloatFormat } from 'roosterjs-content-model-types';
import { FormatRenderer } from '../utils/FormatRenderer';

export const FloatFormatRenderer: FormatRenderer<FloatFormat> = createTextFormatRenderer<
FloatFormat
>(
'Float',
format => format.float,
(format, value) => (format.float = value)
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ContentModelCodeView } from './ContentModelCodeView';
import { ContentModelImage, ContentModelImageFormat } from 'roosterjs-content-model-types';
import { ContentModelLinkView } from './ContentModelLinkView';
import { ContentModelView } from '../ContentModelView';
import { FloatFormatRenderer } from '../format/formatPart/FloatFormatRenderer';
import { FormatRenderer } from '../format/utils/FormatRenderer';
import { FormatView } from '../format/FormatView';
import { IdFormatRenderer } from '../format/formatPart/IdFormatRenderer';
Expand All @@ -22,6 +23,7 @@ const ImageFormatRenderers: FormatRenderer<ContentModelImageFormat>[] = [
...SizeFormatRenderers,
MarginFormatRenderer,
PaddingFormatRenderer,
FloatFormatRenderer,
];

export function ContentModelImageView(props: { image: ContentModelImage }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ContentModelSegmentFormat } from 'roosterjs-content-model-types';
import { EditorPlugin, IEditor, PluginEvent, PluginEventType } from 'roosterjs-editor-types';
import {
applySegmentFormat,
getSegmentFormat,
getFormatState,
IContentModelEditor,
} from 'roosterjs-content-model-editor';

Expand Down Expand Up @@ -53,13 +53,13 @@ export default class ContentModelFormatPainterPlugin implements EditorPlugin {
}
}

function getFormatHolder(editor: IEditor): FormatPainterFormatHolder {
function getFormatHolder(editor: IContentModelEditor): FormatPainterFormatHolder {
return editor.getCustomData('__FormatPainterFormat', () => {
return {} as FormatPainterFormatHolder;
});
}

function setFormatPainterCursor(editor: IEditor, isOn: boolean) {
function setFormatPainterCursor(editor: IContentModelEditor, isOn: boolean) {
let styles = editor.getEditorDomAttribute('style') || '';
styles = styles.replace(CURSOR_REGEX, '');

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

editor.setEditorDomAttribute('style', styles);
}

function getSegmentFormat(editor: IContentModelEditor): ContentModelSegmentFormat {
const formatState = getFormatState(editor);

return {
backgroundColor: formatState.backgroundColor,
fontFamily: formatState.fontName,
fontSize: formatState.fontSize,
fontWeight: formatState.isBold ? 'bold' : 'normal',
italic: formatState.isItalic,
letterSpacing: formatState.letterSpacing,
strikethrough: formatState.isStrikeThrough,
superOrSubScriptSequence: formatState.isSubscript
? 'sub'
: formatState.isSuperscript
? 'super'
: '',
textColor: formatState.textColor,
underline: formatState.isUnderline,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { removeLinkButton } from './removeLinkButton';
import { Ribbon, RibbonButton, RibbonPlugin } from 'roosterjs-react';
import { rtlButton } from './rtlButton';
import { setBulletedListStyleButton } from './setBulletedListStyleButton';
import { setHeaderLevelButton } from './setHeaderLevelButton';
import { setHeadingLevelButton } from './setHeadingLevelButton';
import { setNumberedListStyleButton } from './setNumberedListStyleButton';
import { setTableCellShadeButton } from './setTableCellShadeButton';
import { setTableHeaderButton } from './setTableHeaderButton';
Expand Down Expand Up @@ -84,7 +84,7 @@ const buttons = [
superscriptButton,
subscriptButton,
strikethroughButton,
setHeaderLevelButton,
setHeadingLevelButton,
codeButton,
ltrButton,
rtlButton,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { FormatState, PluginEvent, PluginEventType } from 'roosterjs-editor-types';
import { getFormatState, IContentModelEditor } from 'roosterjs-content-model-editor';
import { getObjectKeys } from 'roosterjs-editor-dom';
import { LocalizedStrings, RibbonButton, RibbonPlugin, UIUtilities } from 'roosterjs-react';
import { PluginEvent, PluginEventType } from 'roosterjs-editor-types';
import {
ContentModelFormatState,
getFormatState,
IContentModelEditor,
} from 'roosterjs-content-model-editor';

export class ContentModelRibbonPlugin implements RibbonPlugin {
private editor: IContentModelEditor | null = null;
private onFormatChanged: ((formatState: FormatState) => void) | null = null;
private onFormatChanged: ((formatState: ContentModelFormatState) => void) | null = null;
private timer = 0;
private formatState: FormatState | null = null;
private formatState: ContentModelFormatState | null = null;
private uiUtilities: UIUtilities | null = null;

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

return () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import showInputDialog from 'roosterjs-react/lib/inputDialog/utils/showInputDialog';
import { InsertLinkButtonStringKey, RibbonButton } from 'roosterjs-react';
import { showInputDialog } from 'roosterjs-react/lib/inputDialog';
import {
adjustLinkSelection,
insertLink,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { isContentModelEditor, setHeadingLevel } from 'roosterjs-content-model-editor';
import {
getButtons,
HeadingButtonStringKey,
KnownRibbonButtonKey,
RibbonButton,
} from 'roosterjs-react';

const originalHeadingButton: RibbonButton<HeadingButtonStringKey> = getButtons([
KnownRibbonButtonKey.Heading,
])[0] as RibbonButton<HeadingButtonStringKey>;
const keys: HeadingButtonStringKey[] = [
'buttonNameNoHeading',
'buttonNameHeading1',
'buttonNameHeading2',
'buttonNameHeading3',
'buttonNameHeading4',
'buttonNameHeading5',
'buttonNameHeading6',
];

export const setHeadingLevelButton: RibbonButton<HeadingButtonStringKey> = {
dropDownMenu: {
...originalHeadingButton.dropDownMenu,
},
key: 'buttonNameHeading',
unlocalizedText: 'Heading',
iconName: 'Header1',
onClick: (editor, key) => {
const headingLevel = keys.indexOf(key);

if (isContentModelEditor(editor) && headingLevel >= 0) {
setHeadingLevel(editor, headingLevel as 0 | 1 | 2 | 3 | 4 | 5 | 6);
}
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IEditor, PluginEvent } from 'roosterjs-editor-types';
import { SidePaneElementProps } from '../SidePaneElement';

export default interface ApiPaneProps extends SidePaneElementProps {
getEditor: () => IEditor;
}

export interface ApiPlaygroundComponent {
onPluginEvent?: (e: PluginEvent) => void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.header {
flex: 0 0 auto;
padding-bottom: 5px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import * as React from 'react';
import apiEntries, { ApiPlaygroundReactComponent } from './apiEntries';
import ApiPaneProps from './ApiPaneProps';
import { getObjectKeys } from 'roosterjs-editor-dom';
import { PluginEvent } from 'roosterjs-editor-types';
import { SidePaneElement } from '../SidePaneElement';

const styles = require('./ApiPlaygroundPane.scss');

export interface ApiPlaygroundPaneState {
current: string;
}

export default class ApiPlaygroundPane extends React.Component<ApiPaneProps, ApiPlaygroundPaneState>
implements SidePaneElement {
private select = React.createRef<HTMLSelectElement>();
private pane = React.createRef<ApiPlaygroundReactComponent>();
constructor(props: ApiPaneProps) {
super(props);
this.state = { current: 'empty' };
}

render() {
let componentClass = apiEntries[this.state.current].component;
let pane: JSX.Element = null;
if (componentClass) {
pane = React.createElement(componentClass, { ...this.props, ref: this.pane });
}

return (
<>
<div className={styles.header}>
<h3>Select an API to try</h3>

<select ref={this.select} value={this.state.current} onChange={this.onChange}>
{getObjectKeys(apiEntries).map(key => (
<option value={key} key={key}>
{apiEntries[key].name}
</option>
))}
</select>
</div>
{pane}
</>
);
}

onPluginEvent(e: PluginEvent) {
if (this.pane.current && this.pane.current.onPluginEvent) {
this.pane.current.onPluginEvent(e);
}
}

setHashPath(path: string[]) {
let paneName = path && getObjectKeys(apiEntries).indexOf(path[0]) >= 0 ? path[0] : null;

if (paneName && paneName != this.state.current) {
this.setState({
current: paneName,
});
} else {
this.props.updateHash(null, [this.state.current]);
}
}

private onChange = () => {
this.props.updateHash(null, [this.select.current.value]);
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import ApiPaneProps from './ApiPaneProps';
import ApiPlaygroundPane from './ApiPlaygroundPane';
import SidePanePluginImpl from '../SidePanePluginImpl';
import { PluginEvent } from 'roosterjs-editor-types';
import { SidePaneElementProps } from '../SidePaneElement';

export default class ApiPlaygroundPlugin extends SidePanePluginImpl<
ApiPlaygroundPane,
ApiPaneProps
> {
constructor() {
super(ApiPlaygroundPane, 'api', 'API Playground');
}

getComponentProps(base: SidePaneElementProps) {
return {
...base,
getEditor: () => {
return this.editor;
},
};
}

onPluginEvent(e: PluginEvent) {
this.getComponent(component => component.onPluginEvent(e));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as React from 'react';
import ApiPaneProps, { ApiPlaygroundComponent } from './ApiPaneProps';
import InsertEntityPane from './insertEntity/InsertEntityPane';

export interface ApiPlaygroundReactComponent
extends React.Component<ApiPaneProps, any>,
ApiPlaygroundComponent {}

interface ApiEntry {
name: string;
component?: { new (prpos: ApiPaneProps): ApiPlaygroundReactComponent };
}

const apiEntries: { [key: string]: ApiEntry } = {
empty: {
name: 'Please select',
},
entity: {
name: 'Insert Entity',
component: InsertEntityPane,
},
more: {
name: 'Coming soon...',
},
};

export default apiEntries;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.textarea {
outline: none;
resize: none;
min-height: 40px;
width: 90%;
}
Loading