Skip to content

Commit

Permalink
Merge branch 'master' into u/bvalverde/fixExcelPasteWithProgramaticRe…
Browse files Browse the repository at this point in the history
…trievalOfClipboard
  • Loading branch information
BryanValverdeU authored Feb 18, 2025
2 parents c5337af + ce1afbe commit 4a00cd5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { adjustTrailingSpaceSelection } from '../../modelApi/selection/adjustTrailingSpaceSelection';
import { formatSegmentWithContentModel } from '../utils/formatSegmentWithContentModel';
import type { IEditor } from 'roosterjs-content-model-types';

Expand All @@ -20,7 +19,6 @@ export function toggleUnderline(editor: IEditor) {
}
},
(format, segment) => !!format.underline || !!segment?.link?.format?.underline,
false /*includingFormatHolder*/,
adjustTrailingSpaceSelection
false /*includingFormatHolder*/
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -491,18 +491,12 @@ describe('toggleUnderline', () => {
segments: [
{
segmentType: 'Text',
text: 'Test',
text: 'Test ',
format: {
underline: true,
},
isSelected: true,
},
{
segmentType: 'Text',
text: ' ',
format: {},
isSelected: true,
},
],
format: {},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ContentHandlers: {
['text/plain']: (data, value) => (data.text = value),
['text/*']: (data, value, type?) => !!type && (data.customValues[type] = value),
['text/link-preview']: tryParseLinkPreview,
['text/uri-list']: (data, value) => (data.text = value),
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,20 @@ describe('extractClipboardItems', () => {
pasteNativeEvent: true,
});
});

it('input with text/uri-list', async () => {
const text = 'https://example.com';
const clipboardData = await extractClipboardItems([
createStringItem('text/uri-list', text),
]);
expect(clipboardData).toEqual({
types: ['text/uri-list'],
text: text,
image: null,
files: [],
rawHtml: null,
customValues: {},
pasteNativeEvent: true,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ class RibbonPluginImpl implements RibbonPlugin {
private updateFormat() {
if (this.editor && this.onFormatChanged) {
const newFormatState = getFormatState(this.editor);
const newFormatKeys = getObjectKeys(newFormatState);

if (
!this.formatState ||
newFormatKeys.length != getObjectKeys(this.formatState).length ||
getObjectKeys(newFormatState).some(
key => newFormatState[key] != this.formatState?.[key]
)
Expand Down

0 comments on commit 4a00cd5

Please sign in to comment.