slate-angular 19.1.2 → 19.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -882,12 +882,42 @@ const setClipboardData = async (clipboardData, wrapper, attach, dataTransfer) =>
|
|
|
882
882
|
setDataTransferClipboardText(dataTransfer, text);
|
|
883
883
|
return;
|
|
884
884
|
}
|
|
885
|
+
const htmlText = buildHTMLText(wrapper, attach, elements);
|
|
885
886
|
// Compatible with situations where navigator.clipboard.write is not supported and dataTransfer is empty
|
|
886
887
|
// Such as contextmenu copy in Firefox.
|
|
887
888
|
if (isClipboardWriteTextSupported()) {
|
|
888
|
-
const htmlText = buildHTMLText(wrapper, attach, elements);
|
|
889
889
|
return await navigator.clipboard.writeText(htmlText);
|
|
890
890
|
}
|
|
891
|
+
else {
|
|
892
|
+
return await fallbackCopyText(htmlText);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
const fallbackCopyText = async (text) => {
|
|
896
|
+
return new Promise((resolve, reject) => {
|
|
897
|
+
const textArea = document.createElement('textarea');
|
|
898
|
+
textArea.value = text;
|
|
899
|
+
textArea.style.position = 'fixed';
|
|
900
|
+
textArea.style.left = '-999999px';
|
|
901
|
+
textArea.style.top = '-999999px';
|
|
902
|
+
textArea.style.opacity = '0';
|
|
903
|
+
document.body.appendChild(textArea);
|
|
904
|
+
textArea.focus();
|
|
905
|
+
textArea.select();
|
|
906
|
+
try {
|
|
907
|
+
const successful = document.execCommand('copy');
|
|
908
|
+
document.body.removeChild(textArea);
|
|
909
|
+
if (successful) {
|
|
910
|
+
resolve();
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
reject(new Error('execCommand error'));
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
catch (err) {
|
|
917
|
+
document.body.removeChild(textArea);
|
|
918
|
+
reject(err);
|
|
919
|
+
}
|
|
920
|
+
});
|
|
891
921
|
};
|
|
892
922
|
|
|
893
923
|
const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
@@ -4039,5 +4069,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4039
4069
|
* Generated bundle index. Do not edit.
|
|
4040
4070
|
*/
|
|
4041
4071
|
|
|
4042
|
-
export { AngularEditor, BaseComponent, BaseElementComponent, BaseLeafComponent, BaseTextComponent, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_IOS, IS_QQBROWSER, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, PLACEHOLDER_SYMBOL, SlateChildren, SlateChildrenOutlet, SlateDefaultString, SlateEditable, SlateElement, SlateErrorCode, SlateFragmentAttributeKey, SlateLeaves, SlateModule, SlateString, blobAsString, buildHTMLText, check, completeTable, createClipboardData, createThrottleRAF, defaultScrollSelectionIntoView, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getSelection, getSlateFragmentAttribute, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDecoratorRangeListEqual, isEmpty, isInvalidTable, isTemplateRef, isValid, normalize, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
|
|
4072
|
+
export { AngularEditor, BaseComponent, BaseElementComponent, BaseLeafComponent, BaseTextComponent, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_IOS, IS_QQBROWSER, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, PLACEHOLDER_SYMBOL, SlateChildren, SlateChildrenOutlet, SlateDefaultString, SlateEditable, SlateElement, SlateErrorCode, SlateFragmentAttributeKey, SlateLeaves, SlateModule, SlateString, blobAsString, buildHTMLText, check, completeTable, createClipboardData, createThrottleRAF, defaultScrollSelectionIntoView, fallbackCopyText, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getSelection, getSlateFragmentAttribute, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDecoratorRangeListEqual, isEmpty, isInvalidTable, isTemplateRef, isValid, normalize, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
|
|
4043
4073
|
//# sourceMappingURL=slate-angular.mjs.map
|