delphidabbler / codesnip

A code bank designed with Pascal in mind
https://delphidabbler.com/software/codesnip
Other
110 stars 33 forks source link

Snippets editor sometimes strips `<p>` REML tags #103

Closed delphidabbler closed 1 year ago

delphidabbler commented 1 year ago

When editing a snippet that has a description or extra information that contains a single paragraph embedded in <p>..</p> REML tags, the tags are getting stripped and the paragraph is treated as plain text.

That was OK before issues #81 and #82 got fixed, but now it's causing active text that should be treated as a paragraph to be treated as an un-formatted block.

delphidabbler commented 1 year ago

Problem could be here:

function TActiveText.IsPlainText: Boolean;
var
  Elem: IActiveTextElem;
  ActionElem: IActiveTextActionElem;
begin
  for Elem in fElems do
  begin
    if Supports(Elem, IActiveTextActionElem, ActionElem)
      and not (ActionElem.Kind in [ekPara, ekDocument]) then
      Exit(False);
  end;
  Result := True;
end;

Need to change test

    if Supports(Elem, IActiveTextActionElem, ActionElem)
      and not (ActionElem.Kind in [ekPara, ekDocument]) then

to

    if Supports(Elem, IActiveTextActionElem, ActionElem)
      and not (ActionElem.Kind in [ekBlock, ekDocument]) then
delphidabbler commented 1 year ago

Fixed by merge commit 483496a2fc5aad43711329fe91ec0fb47ccf496d