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

Fix LT-21933: Picture thumbnail is not showing configuration dialog #200

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
11 changes: 9 additions & 2 deletions Src/xWorks/ConfiguredLcmGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ private static string GenerateSrcAttributeFromFilePath(ICmFile file, string subF
{
filePath = MakeSafeFilePath(file.AbsoluteInternalPath);
}
return filePath;
return (settings.UseRelativePaths || !settings.UseUri) ? filePath : new Uri(filePath).ToString();
}

private static string GenerateSrcAttributeForMediaFromFilePath(string filename, string subFolder, GeneratorSettings settings)
Expand Down Expand Up @@ -3175,6 +3175,8 @@ public class GeneratorSettings
public LcmCache Cache { get; }
public ReadOnlyPropertyTable PropertyTable { get; }
public bool UseRelativePaths { get; }

public bool UseUri { get; }
public bool CopyFiles { get; }
public string ExportPath { get; }
public bool RightToLeft { get; }
Expand All @@ -3186,8 +3188,12 @@ public GeneratorSettings(LcmCache cache, PropertyTable propertyTable, bool relat
{
}


public GeneratorSettings(LcmCache cache, ReadOnlyPropertyTable propertyTable, bool relativePaths, bool copyFiles, string exportPath, bool rightToLeft = false, bool isWebExport = false, bool isTemplate = false)
: this(cache, propertyTable == null ? null : propertyTable, relativePaths, true, copyFiles, exportPath, rightToLeft, isWebExport, isTemplate)
{
}

public GeneratorSettings(LcmCache cache, ReadOnlyPropertyTable propertyTable, bool relativePaths, bool useUri, bool copyFiles, string exportPath, bool rightToLeft = false, bool isWebExport = false, bool isTemplate = false)
{
if (cache == null || propertyTable == null)
{
Expand All @@ -3196,6 +3202,7 @@ public GeneratorSettings(LcmCache cache, ReadOnlyPropertyTable propertyTable, bo
Cache = cache;
PropertyTable = propertyTable;
UseRelativePaths = relativePaths;
UseUri = useUri;
CopyFiles = copyFiles;
ExportPath = exportPath;
RightToLeft = rightToLeft;
Expand Down
3 changes: 2 additions & 1 deletion Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public static void SavePublishedDocx(int[] entryHvos, DictionaryPublicationDecor

generator.Init(readOnlyPropertyTable);
IsBidi = ConfiguredLcmGenerator.IsEntryStyleRtl(readOnlyPropertyTable, configuration);
var settings = new ConfiguredLcmGenerator.GeneratorSettings(cache, readOnlyPropertyTable, false, true, System.IO.Path.GetDirectoryName(filePath),
// Call GeneratorSettings with relativesPaths = false but useUri = false because that works better for Word.
var settings = new ConfiguredLcmGenerator.GeneratorSettings(cache, readOnlyPropertyTable, false, false, true, System.IO.Path.GetDirectoryName(filePath),
IsBidi, System.IO.Path.GetFileName(cssPath) == "configured.css")
{ ContentGenerator = generator, StylesGenerator = generator};
settings.StylesGenerator.AddGlobalStyles(configuration, readOnlyPropertyTable);
Expand Down
Loading