YAFLogo

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
If I paste in copied text (from another web page) when using SCEditor BBCodes appear in the posted message. For example:

Frequently asked questions

How long should you cook sugar snap peas?

[font=corporate-s, "Helvetica Neue", Helvetica, Arial, sans-serif]Sugar snap peas should be cooked for just a few minutes to keep their crunch and vibrant colour. When stir-frying, 3-4 minutes is usually enough. If boiling, they only need 1-2 minutes in simmering water.[/font]

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 months ago
That seems to be the normal behavior in the editor to copy all the content.

at the moment if you only want to paste the text use the paste button

 Screenshot 2024-07-12 083505.png You have insufficient rights to see the content.

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
Thanks. Do you know if there is a javascript method included which can be called to clean text of html and bbcode? I thought I could attach an event handler (like below) and call it from there.

​ var sceditorContainer = document.querySelector('.sceditor-container');
 if (sceditorContainer) {
     sceditorContainer.addEventListener('paste', handlePaste);
     console.log('Paste event listener added to SCEditor container');
 } else {
     console.log('SCEditor container not found');
 }

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 months ago
i updated the editor in the repository. Now it only paste the text.
BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
Thanks, but I'm still seeing the bbcodes in the message when I ctrl+V. What I've done on my development machine is...

1) Upgrade from 3.2.5 to 3.2.6 (No problem0

2) Apply the "use plain text plugin" commits from github

3) Run grunt and recompile all projects in Visual Studio

This is what appears in the message:

[font=GuardianTextEgyptian, "Guardian Text Egyptian Web", Georgia, serif]“For us this week the focus is reducing our turnover rate,” says Warren Gatland.[/font]

[font=GuardianTextEgyptian, "Guardian Text Egyptian Web", Georgia, serif]“That allowed Australia some really soft tries at the end.”[/font]

[font=GuardianTextEgyptian, "Guardian Text Egyptian Web", Georgia, serif]I hope he’s also focussed on execution in Australia’s red zone. There were a few moments where they could have put the game to bed themselves.[/font]

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
Sorry, I should have posted the link where that text was from:

https://www.theguardian.com/sport/live/2024/jul/13/australia-wallabies-vs-wales-rugby-union-international-test-live-updates-score-results-teams-kick-off-aami-park-melbourne 

[color=var(--bs-body-color)][font=system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"]I suspect the problem is related to double quotes. [/font][/color]

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 months ago
i forgot to update the gruntfile. Now it includes the plaintext plugin
BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
Great work thanks. I've upgraded to 3.2.6 and integrated the changes for the plaintext plugin. First impressions are it is an improvement and works well, but if there are problems my users will usually find them quickly!
BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
I've now been using this on my forum for a few days. There is still a problem with bbcodes appearing in some posts. It appears to happen if text is moved (or perhaps editing what has been pasted) around inside the message editor.
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 months ago
Is this issue reproducable?
BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
Yes, I think so. Type as below in the editor. 

 1) Type Test. 

2) Press Enter and paste a URL in on the new line

3) Place the cursor at the start of the URL

4) Press backspace to bring the URL onto the same line as Test.

5) Post the message. Bbcodes appear. 

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 months ago
Thanks i was able to reproduce it. this happens always on backspace. The function is now disabled. I updated the js files in the source repository.
BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago
In the source repository I can see changes have been applied to sceditor.min.js and defaultOptions.js.

I've updated sceditor.min.js in VS. The defaultOptions.js doesn't show up because it is in the node_modules folder, so I edited it in notepad.

The project builds fine, but the problem is still occuring for me. When making a post in the sceditor.comb.min.js this appears disableBlockRemove:!0 instead of disableBlockRemove:!1 so it looks like the changes have been applied.

Am I doing something wrong?

BWG

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 months ago

In the source repository I can see changes have been applied to sceditor.min.js and defaultOptions.js.

I've updated sceditor.min.js in VS. The defaultOptions.js doesn't show up because it is in the node_modules folder, so I edited it in notepad.

The project builds fine, but the problem is still occuring for me. When making a post in the sceditor.comb.min.js this appears disableBlockRemove:!0 instead of disableBlockRemove:!1 so it looks like the changes have been applied.

Am I doing something wrong?

BWG

Originally Posted by: BWG 

Sorry, this was a mistake on my end. The setting change did indeed does not fix the issue. This issue is a bug of the editor. If possible i find a way to fix this.

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
11 months ago

In the source repository I can see changes have been applied to sceditor.min.js and defaultOptions.js.

I've updated sceditor.min.js in VS. The defaultOptions.js doesn't show up because it is in the node_modules folder, so I edited it in notepad.

The project builds fine, but the problem is still occuring for me. When making a post in the sceditor.comb.min.js this appears disableBlockRemove:!0 instead of disableBlockRemove:!1 so it looks like the changes have been applied.

Am I doing something wrong?

BWG

Originally Posted by: tha_watcha 

Sorry, this was a mistake on my end. The setting change did indeed does not fix the issue. This issue is a bug of the editor. If possible i find a way to fix this.

Originally Posted by: BWG 

Thanks for the update. 

A fix to this would be much appreciated.

BWG