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

Bump Content model packages to 9.1.0, #2573

Merged
merged 57 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ba053e7
code suport
juliaroldi Mar 26, 2024
48f2fae
markdown
juliaroldi Mar 26, 2024
f9a11a0
conflicts
juliaroldi Apr 1, 2024
1f105ff
adjust
juliaroldi Apr 1, 2024
02ecb84
Merge branch 'master' into u/juliaroldi/port-markdown-plugin-2
juliaroldi Apr 1, 2024
287a8df
demo site
juliaroldi Apr 1, 2024
716f914
Merge branch 'u/juliaroldi/port-markdown-plugin-2' of https://github.…
juliaroldi Apr 1, 2024
c712f3b
WIP
juliaroldi Apr 1, 2024
34ac350
fix code pen
juliaroldi Apr 1, 2024
7489c6d
fix demo site
juliaroldi Apr 1, 2024
1c276af
Merge pull request #2527 from microsoft/u/juliaroldi/port-markdown-pl…
juliaroldi Apr 1, 2024
a5967fb
fix conflixts
juliaroldi Apr 1, 2024
f362e01
Handle Tab key on whole table selection or last cell on Edit Plugin (…
Andres-CT98 Apr 1, 2024
13543b9
Merge branch 'master' into u/juliaroldi/auto-format-demo-site
juliaroldi Apr 2, 2024
9460c0c
Merge pull request #2549 from microsoft/u/juliaroldi/auto-format-demo…
juliaroldi Apr 2, 2024
ef49253
Fix seelection on void element (#2551)
JiuqingSong Apr 2, 2024
498a9f4
port hyphen
juliaroldi Apr 2, 2024
259a94c
Merge branch 'master' into u/juliaroldi/auto-hypen-port
juliaroldi Apr 2, 2024
182ed16
Implement movement with Tab key inside Table (#2529)
Andres-CT98 Apr 2, 2024
28ecdae
fix tests
juliaroldi Apr 3, 2024
f9514d6
Merge branch 'u/juliaroldi/auto-hypen-port' of https://github.com/mic…
juliaroldi Apr 3, 2024
aa92ec3
Merge branch 'master' into u/juliaroldi/auto-hypen-port
juliaroldi Apr 3, 2024
80f1eca
add formatTextSegmentBeforeSelectionMarker
juliaroldi Apr 3, 2024
7995f21
Merge branch 'u/juliaroldi/auto-hypen-port' of https://github.com/mic…
juliaroldi Apr 3, 2024
154d72d
Improve backspace on list (#2555)
JiuqingSong Apr 3, 2024
4ace57a
fix selection with ctrl+a
juliaroldi Apr 3, 2024
1377277
Merge branch 'master' into u/juliaroldi/adjust-image-selection
juliaroldi Apr 3, 2024
12dc692
Merge pull request #2556 from microsoft/u/juliaroldi/adjust-image-sel…
juliaroldi Apr 4, 2024
b1b398e
refactor code using formatTextSegmentBeforeSelectionMarkerTest
juliaroldi Apr 4, 2024
c1b2a9d
remove getLinkSegment
juliaroldi Apr 4, 2024
4bb65d7
Merge branch 'master' into u/juliaroldi/format-segment-before-text
juliaroldi Apr 4, 2024
f34b360
Merge pull request #2557 from microsoft/u/juliaroldi/format-segment-b…
juliaroldi Apr 4, 2024
35c3a33
Set default format in demo site (#2559)
JiuqingSong Apr 4, 2024
35e08b3
clean demo site
juliaroldi Apr 5, 2024
3b4c904
clean
juliaroldi Apr 5, 2024
b7d50b4
Enable selecting image when the only element in the range is an Image…
BryanValverdeU Apr 5, 2024
1072c05
fix markdown plugin
juliaroldi Apr 5, 2024
39cd6c0
Merge branch 'master' into u/juliaroldi/add-markdown-options
juliaroldi Apr 5, 2024
bea0bd7
Port Hyperlink plugin (#2560)
JiuqingSong Apr 5, 2024
1958eab
conflicts
juliaroldi Apr 5, 2024
99a3bbf
Merge pull request #2562 from microsoft/u/juliaroldi/clean-content-edit
juliaroldi Apr 5, 2024
a8982cd
fix conflicts
juliaroldi Apr 5, 2024
4065ba6
Merge branch 'u/juliaroldi/add-markdown-options' of https://github.co…
juliaroldi Apr 5, 2024
31037a1
Merge pull request #2563 from microsoft/u/juliaroldi/add-markdown-opt…
juliaroldi Apr 5, 2024
7d865b9
export formatTextSegmentBeforeSelectionMarker
juliaroldi Apr 5, 2024
b55fe2c
fix build
juliaroldi Apr 5, 2024
53f1f4d
Prevent ScrollTop to be lost when the focus is done to the editor (#2…
BryanValverdeU Apr 5, 2024
29d5315
Merge branch 'master' into u/juliaroldi/export-formatSegment
BryanValverdeU Apr 5, 2024
86cc784
Merge pull request #2565 from microsoft/u/juliaroldi/export-formatSeg…
juliaroldi Apr 5, 2024
a4457db
Fix 265959: extra empty line generated when get plain text (#2566)
JiuqingSong Apr 5, 2024
2088aa5
Fix #2500 Hyperlink misses color (#2570)
JiuqingSong Apr 9, 2024
4974e92
Merge branch 'master' of https://github.com/microsoft/roosterjs into …
BryanValverdeU Apr 12, 2024
8c9f356
Update version.json
BryanValverdeU Apr 12, 2024
4ffd535
mac shortcuts
juliaroldi Apr 12, 2024
7ea28f9
fix test
juliaroldi Apr 12, 2024
25f0296
Merge pull request #2574 from microsoft/u/juliaroldi/mac-shortucuts
juliaroldi Apr 12, 2024
b1b2768
Merge branch 'master' of https://github.com/microsoft/roosterjs into …
BryanValverdeU Apr 12, 2024
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
22 changes: 19 additions & 3 deletions demo/scripts/controlsV2/demoButtons/exportContentButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import type { RibbonButton } from '../roosterjsReact/ribbon';
/**
* Key of localized strings of Zoom button
*/
export type ExportButtonStringKey = 'buttonNameExport';
export type ExportButtonStringKey =
| 'buttonNameExport'
| 'menuNameExportHTML'
| 'menuNameExportText';

/**
* "Export content" button on the format ribbon
Expand All @@ -14,9 +17,22 @@ export const exportContentButton: RibbonButton<ExportButtonStringKey> = {
unlocalizedText: 'Export',
iconName: 'Export',
flipWhenRtl: true,
onClick: editor => {
dropDownMenu: {
items: {
menuNameExportHTML: 'as HTML',
menuNameExportText: 'as Plain Text',
},
},
onClick: (editor, key) => {
const win = editor.getDocument().defaultView.open();
const html = exportContent(editor);
let html = '';

if (key == 'menuNameExportHTML') {
html = exportContent(editor);
} else if (key == 'menuNameExportText') {
html = `<pre>${exportContent(editor, 'PlainText')}</pre>`;
}

win.document.write(editor.getTrustedHTMLHandler()(html));
},
commandBarProperties: {
Expand Down
27 changes: 13 additions & 14 deletions demo/scripts/controlsV2/mainPane/MainPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { getDarkColor } from 'roosterjs-color-utils';
import { getPresetModelById } from '../sidePane/presets/allPresets/allPresets';
import { getTabs, tabNames } from '../tabs/getTabs';
import { getTheme } from '../theme/themes';
import { OptionState } from '../sidePane/editorOptions/OptionState';
import { OptionState, UrlPlaceholder } from '../sidePane/editorOptions/OptionState';
import { popoutButton } from '../demoButtons/popoutButton';
import { PresetPlugin } from '../sidePane/presets/PresetPlugin';
import { redoButton } from '../roosterjsReact/ribbon/buttons/redoButton';
Expand All @@ -47,6 +47,7 @@ import {
import {
AutoFormatPlugin,
EditPlugin,
HyperlinkPlugin,
MarkdownPlugin,
PastePlugin,
ShortcutPlugin,
Expand Down Expand Up @@ -474,33 +475,31 @@ export class MainPane extends React.Component<{}, MainPaneState> {
tableMenu,
imageMenu,
watermarkText,
markdownOptions,
autoFormatOptions,
linkTitle,
} = this.state.initState;
return [
pluginList.autoFormat &&
new AutoFormatPlugin({
autoBullet: true,
autoNumbering: true,
autoUnlink: true,
autoLink: true,
}),
pluginList.autoFormat && new AutoFormatPlugin(autoFormatOptions),
pluginList.edit && new EditPlugin(),
pluginList.paste && new PastePlugin(allowExcelNoBorderTable),
pluginList.shortcut && new ShortcutPlugin(),
pluginList.tableEdit && new TableEditPlugin(),
pluginList.watermark && new WatermarkPlugin(watermarkText),
pluginList.markdown &&
new MarkdownPlugin({
bold: true,
italic: true,
strikethrough: true,
}),
pluginList.markdown && new MarkdownPlugin(markdownOptions),
pluginList.emoji && createEmojiPlugin(),
pluginList.pasteOption && createPasteOptionPlugin(),
pluginList.sampleEntity && new SampleEntityPlugin(),
pluginList.contextMenu && createContextMenuPlugin(),
pluginList.contextMenu && listMenu && createListEditMenuProvider(),
pluginList.contextMenu && tableMenu && createTableEditMenuProvider(),
pluginList.contextMenu && imageMenu && createImageEditMenuProvider(),
pluginList.hyperlink &&
new HyperlinkPlugin(
linkTitle?.indexOf(UrlPlaceholder) >= 0
? url => linkTitle.replace(UrlPlaceholder, url)
: linkTitle
),
].filter(x => !!x);
}
}
Expand Down
26 changes: 3 additions & 23 deletions demo/scripts/controlsV2/plugins/createLegacyPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
import { Announce, CustomReplace, ImageEdit } from 'roosterjs-editor-plugins';
import { EditorPlugin as LegacyEditorPlugin, KnownAnnounceStrings } from 'roosterjs-editor-types';
import {
Announce,
ContentEdit,
CustomReplace,
HyperLink,
ImageEdit,
} from 'roosterjs-editor-plugins';
import {
LegacyPluginList,
OptionState,
UrlPlaceholder,
} from '../sidePane/editorOptions/OptionState';
import { LegacyPluginList, OptionState } from '../sidePane/editorOptions/OptionState';

export function createLegacyPlugins(initState: OptionState): LegacyEditorPlugin[] {
const { pluginList, linkTitle } = initState;
const { pluginList } = initState;

const plugins: Record<keyof LegacyPluginList, LegacyEditorPlugin | null> = {
contentEdit: pluginList.contentEdit ? new ContentEdit(initState.contentEditFeatures) : null,
hyperlink: pluginList.hyperlink
? new HyperLink(
linkTitle?.indexOf(UrlPlaceholder) >= 0
? url => linkTitle.replace(UrlPlaceholder, url)
: linkTitle
? () => linkTitle
: null
)
: null,
imageEdit: pluginList.imageEdit
? new ImageEdit({
preserveRatio: initState.forcePreserveRatio,
Expand Down
117 changes: 0 additions & 117 deletions demo/scripts/controlsV2/sidePane/editorOptions/ContentEditFeatures.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class DefaultFormatPane extends React.Component<DefaultFormatProps, {}> {
[NOT_SET]: 'Not Set',
'8pt': '8',
'10pt': '10',
'11pt': '11',
'12pt': '12',
'16pt': '16',
'20pt': '20',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getDefaultContentEditFeatureSettings } from './getDefaultContentEditFeatureSettings';
import { OptionPaneProps, OptionState, UrlPlaceholder } from './OptionState';
import { OptionsPane } from './OptionsPane';
import { SidePaneElementProps } from '../SidePaneElement';
Expand All @@ -17,16 +16,18 @@ const initialState: OptionState = {
pasteOption: true,
sampleEntity: true,
markdown: true,
hyperlink: true,

// Legacy plugins
contentEdit: false,
hyperlink: false,
imageEdit: false,
customReplace: false,
announce: false,
},
contentEditFeatures: getDefaultContentEditFeatureSettings(),
defaultFormat: {},
defaultFormat: {
fontFamily: 'Calibri',
fontSize: '11pt',
textColor: '#000000',
},
linkTitle: 'Ctrl+Click to follow the link:' + UrlPlaceholder,
watermarkText: 'Type content here ...',
forcePreserveRatio: false,
Expand All @@ -43,6 +44,13 @@ const initialState: OptionState = {
autoLink: true,
autoNumbering: true,
autoUnlink: false,
autoHyphen: true,
},
markdownOptions: {
bold: true,
italic: true,
strikethrough: true,
codeFormat: {},
},
};

Expand Down
8 changes: 3 additions & 5 deletions demo/scripts/controlsV2/sidePane/editorOptions/OptionState.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { AutoFormatOptions } from 'roosterjs-content-model-plugins';
import type { ContentEditFeatureSettings } from 'roosterjs-editor-types';
import { AutoFormatOptions, MarkdownOptions } from 'roosterjs-content-model-plugins';
import type { SidePaneElementProps } from '../SidePaneElement';
import type { ContentModelSegmentFormat } from 'roosterjs-content-model-types';

export interface LegacyPluginList {
contentEdit: boolean;
hyperlink: boolean;
imageEdit: boolean;
customReplace: boolean;
announce: boolean;
Expand All @@ -23,6 +20,7 @@ export interface NewPluginList {
pasteOption: boolean;
sampleEntity: boolean;
markdown: boolean;
hyperlink: boolean;
}

export interface BuildInPluginList extends LegacyPluginList, NewPluginList {}
Expand All @@ -37,9 +35,9 @@ export interface OptionState {
imageMenu: boolean;
watermarkText: string;
autoFormatOptions: AutoFormatOptions;
markdownOptions: MarkdownOptions;

// Legacy plugin options
contentEditFeatures: ContentEditFeatureSettings;
defaultFormat: ContentModelSegmentFormat;
linkTitle: string;
forcePreserveRatio: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export class OptionsPane extends React.Component<OptionPaneProps, OptionState> {
linkTitle: this.state.linkTitle,
watermarkText: this.state.watermarkText,
pluginList: { ...this.state.pluginList },
contentEditFeatures: { ...this.state.contentEditFeatures },
defaultFormat: { ...this.state.defaultFormat },
forcePreserveRatio: this.state.forcePreserveRatio,
applyChangesOnMouseUp: this.state.applyChangesOnMouseUp,
Expand All @@ -139,6 +138,7 @@ export class OptionsPane extends React.Component<OptionPaneProps, OptionState> {
tableMenu: this.state.tableMenu,
imageMenu: this.state.imageMenu,
autoFormatOptions: { ...this.state.autoFormatOptions },
markdownOptions: { ...this.state.markdownOptions },
};

if (callback) {
Expand Down
Loading
Loading