Fix pictures in rtf demo

This commit is contained in:
Tom Z?hner
2020-06-17 17:36:57 +02:00
parent da0310146a
commit 52fe8bdf7c
4 changed files with 14 additions and 4 deletions
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -40,7 +40,7 @@ function displayRtfFile(blob) {
var settings = {
onPicture: function(isLegacy, create) {
// isLegacy is null if it's the only available picture (e.g. legacy rtf)
if (isLegacy === legacyPictures) {
if (isLegacy === null || isLegacy === legacyPictures) {
var elem = $(create()).attr("class", "rtfpict"); // WHY does addClass not work on <svg>?!
return setPictBorder(elem, showPicBorder)[0];
}
+11 -1
View File
@@ -31,7 +31,17 @@ import {IContainerElement, Renderer} from "./renderer/Renderer";
export interface ISettings {
onHyperlink?(create: () => HTMLElement, hyperlink: {url: () => string}): IContainerElement;
onPicture?(isLegacy: boolean, create: () => HTMLElement): HTMLElement;
/**
* Callback which is called with information about the type of picture and a function to render it.
* The callback can then decide the output to be rendered.
* @param isLegacy Null if the picture is the only one provided. Otherwise specifies whether the picture
* is a legacy picture (e.g. if both an emf and a wmf version of a picture are available).
* @param create A function which returns the result of rendering the picture.
* @return The {HTMLElement} you want to display
*/
onPicture?(isLegacy: null|boolean, create: () => HTMLElement): HTMLElement;
onImport?(relUrls: string, callback: (data: {error?: Error, keyword?: string, blob?: ArrayBuffer,
width?: number, height?: number}) => void): void;
}