-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]> * version bump --------- Co-authored-by: Jiuqing Song <[email protected]> Co-authored-by: Bryan Valverde U <[email protected]> Co-authored-by: Júlia Roldi <[email protected]> Co-authored-by: Julia Roldi <[email protected]>
- Loading branch information
1 parent
fc1c8bc
commit e2ae751
Showing
165 changed files
with
6,813 additions
and
2,216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
demo/scripts/controls/contentModel/components/format/formatPart/FloatFormatRenderer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
demo/scripts/controls/ribbonButtons/contentModel/insertLinkButton.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
demo/scripts/controls/ribbonButtons/contentModel/setHeaderLevelButton.ts
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
demo/scripts/controls/ribbonButtons/contentModel/setHeadingLevelButton.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}, | ||
}; |
10 changes: 10 additions & 0 deletions
10
demo/scripts/controls/sidePane/contentModelApiPlayground/ApiPaneProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
4 changes: 4 additions & 0 deletions
4
demo/scripts/controls/sidePane/contentModelApiPlayground/ApiPlaygroundPane.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.header { | ||
flex: 0 0 auto; | ||
padding-bottom: 5px; | ||
} |
69 changes: 69 additions & 0 deletions
69
demo/scripts/controls/sidePane/contentModelApiPlayground/ApiPlaygroundPane.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | ||
}; | ||
} |
27 changes: 27 additions & 0 deletions
27
demo/scripts/controls/sidePane/contentModelApiPlayground/ApiPlaygroundPlugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
demo/scripts/controls/sidePane/contentModelApiPlayground/apiEntries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
6 changes: 6 additions & 0 deletions
6
demo/scripts/controls/sidePane/contentModelApiPlayground/insertEntity/InsertEntityPane.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.textarea { | ||
outline: none; | ||
resize: none; | ||
min-height: 40px; | ||
width: 90%; | ||
} |
Oops, something went wrong.