-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump Rooster to 8.40.2 and ContentModel to 0.0.13 (#1522)
* convert alpha to decimals * fix auto format list * add null and refactor * Content Model Selection API step 4: Refactor existing table API (#1479) * Selection API step 1 * Selection API 2 * New selection API * Refactor table API * add test * Support element with namespace (#1489) * Content Model: Fix a bug when process margin (#1493) * Fix margin issue * Fix test * Fix A tag without href (#1495) * Fix Cut/Copy page scroll issue (#1496) * Fix Cut/Copy page scroll issue * Fix test * fix image plugin z-index calc * Content Model Format State Step 1: Refactor formatSegmentWithContentModel() (#1490) * Selection API step 1 * Selection API 2 * New selection API * Refactor table API * add test * Format state step 1 * Improve * update condition per comments * Content Model Format State Step 2: Allow retrieving metadata directly (#1491) * Selection API step 1 * Selection API 2 * New selection API * Refactor table API * add test * Format state step 1 * FormatState step 2 * Improve * Content Model Format State Step 3: Add getFormatState API and ContentModelPlugin (#1492) * Selection API step 1 * Selection API 2 * New selection API * Refactor table API * add test * Format state step 1 * FormatState step 2 * FormatState step 3: Add getFormatState API and ContentModel plugin * Improve * Improve * Improve * fix test * improve, fix safari issue * fix test * Content Model: Add API clearFormat (#1497) * Selection API step 1 * Selection API 2 * New selection API * Refactor table API * add test * Format state step 1 * FormatState step 2 * FormatState step 3: Add getFormatState API and ContentModel plugin * Improve * Content Model: clearFormat * fix build * Improve * Improve * fix test * improve, fix safari issue * fix test * remove wrapper when content change * fix * Content Model: Move format API: link, image, captalization, ... (#1506) * Selection API step 1 * Selection API 2 * New selection API * Refactor table API * add test * Format state step 1 * FormatState step 2 * FormatState step 3: Add getFormatState API and ContentModel plugin * Improve * Content Model: clearFormat * fix build * Improve * Improve * fix test * improve, fix safari issue * fix test * ContentModel: Support insertLink and removeLink * changeCapitalization and setImageAltText * fix for image selection * refactor * refactor * Fix #1509 (#1511) * ContentModel: Improve Divider (#1513) * ContentModel: Improve Divider * Add BorderFormat to ContentModelBlockFormat * Add test * fix build * Content Model: Support "no color" when set color (#1514) * Content Model: Support "no color" when set color * improve * Content Model: Use Entity handle readonly element (#1515) * Content Model: Support get and apply segment format (#1518) * Do not merge table when insert a table (#1519) * bump versions * Content Model: Fix #1239 (#1521) Co-authored-by: Júlia Roldi <[email protected]> Co-authored-by: Jiuqing Song <[email protected]> Co-authored-by: Julia Roldi <[email protected]> Co-authored-by: Shai Petel <[email protected]> Co-authored-by: Shai Petel <[email protected]>
- Loading branch information
1 parent
878b0d3
commit 962fb77
Showing
145 changed files
with
8,114 additions
and
842 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
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/contentModel/components/model/ContentModelDividerView.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.modelDivider { | ||
background-color: #ccf; | ||
background-color: #c0f; | ||
} |
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
71 changes: 71 additions & 0 deletions
71
demo/scripts/controls/contentModel/plugins/FormatPainterPlugin.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,71 @@ | ||
import { EditorPlugin, IEditor, PluginEvent, PluginEventType } from 'roosterjs-editor-types'; | ||
import { | ||
applySegmentFormat, | ||
ContentModelSegmentFormat, | ||
getSegmentFormat, | ||
IExperimentalContentModelEditor, | ||
} from 'roosterjs-content-model'; | ||
|
||
const FORMATPAINTERCURSOR_SVG = require('./formatpaintercursor.svg'); | ||
const FORMATPAINTERCURSOR_STYLE = `;cursor: url("${FORMATPAINTERCURSOR_SVG}") 8.5 16, auto`; | ||
const CURSOR_REGEX = /;?\s*cursor:\s*url\(\".*?\"\)[^;]*/gi; | ||
|
||
interface FormatPainterFormatHolder { | ||
format: ContentModelSegmentFormat | null; | ||
} | ||
|
||
export default class FormatPainterPlugin implements EditorPlugin { | ||
private editor: IExperimentalContentModelEditor | null = null; | ||
|
||
getName() { | ||
return 'FormatPainter'; | ||
} | ||
|
||
initialize(editor: IEditor) { | ||
this.editor = editor as IExperimentalContentModelEditor; | ||
} | ||
|
||
dispose() { | ||
this.editor = null; | ||
} | ||
|
||
onPluginEvent(event: PluginEvent) { | ||
if (this.editor && event.eventType == PluginEventType.MouseUp) { | ||
const formatHolder = getFormatHolder(this.editor); | ||
|
||
if (formatHolder.format) { | ||
applySegmentFormat(this.editor, formatHolder.format); | ||
formatHolder.format = null; | ||
|
||
setFormatPainterCursor(this.editor, false /*isOn*/); | ||
} | ||
} | ||
} | ||
|
||
static startFormatPainter(editor: IExperimentalContentModelEditor) { | ||
const formatHolder = getFormatHolder(editor); | ||
const format = getSegmentFormat(editor); | ||
|
||
if (format) { | ||
formatHolder.format = { ...format }; | ||
setFormatPainterCursor(editor, true /*isOn*/); | ||
} | ||
} | ||
} | ||
|
||
function getFormatHolder(editor: IEditor): FormatPainterFormatHolder { | ||
return editor.getCustomData('__FormatPainterFormat', () => { | ||
return {} as FormatPainterFormatHolder; | ||
}); | ||
} | ||
|
||
function setFormatPainterCursor(editor: IEditor, isOn: boolean) { | ||
let styles = editor.getEditorDomAttribute('style') || ''; | ||
styles = styles.replace(CURSOR_REGEX, ''); | ||
|
||
if (isOn) { | ||
styles += FORMATPAINTERCURSOR_STYLE; | ||
} | ||
|
||
editor.setEditorDomAttribute('style', styles); | ||
} |
22 changes: 22 additions & 0 deletions
22
demo/scripts/controls/contentModel/plugins/formatpaintercursor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.