Work on WebVTT

This commit is contained in:
niksedk 2023-06-13 21:10:06 +02:00
parent 69330fe43a
commit 32146220a8
3 changed files with 7 additions and 2 deletions

View File

@ -385,10 +385,14 @@ namespace Nikse.SubtitleEdit.Core.Common
text = text.Remove(idx, 4);
}
}
else
else if (text.Contains("<c."))
{
text = text.Replace("." + style.Name, string.Empty);
}
else
{
text = "<c." + style.Name + ">" + text + "</c>";
}
return text;
}

View File

@ -478,6 +478,7 @@ namespace Nikse.SubtitleEdit.Controls
}
else if (uiFormat.Name == WebVTT.NameOfFormat || uiFormat.Name == WebVTTFileWithLineNumber.NameOfFormat)
{
//TODO: add some caching!?
var defaultStyle = GetMpvPreviewStyle(Configuration.Settings.General);
defaultStyle.BorderStyle = "3";
subtitle = new Subtitle(subtitle);

View File

@ -14052,7 +14052,7 @@ namespace Nikse.SubtitleEdit.Forms
var c = ColorTranslator.FromHtml(color);
var styleWithColor = WebVttHelper.AddStyleFromColor(c);
subtitle.Header = WebVttHelper.AddStyleToHeader(_subtitle.Header, styleWithColor);
WebVttHelper.AddStyleToText(p.Text, styleWithColor);
p.Text = WebVttHelper.AddStyleToText(p.Text, styleWithColor);
}
catch
{