Open danvim opened 9 years ago
Weird. These are used to persist the selection across input modes, but shouldn't stay in the editor. Can you invetigate this issue yourself? Relevant code is here: https://github.com/bevacqua/woofmark/blob/master/src/rememberSelection.js#L24
https://github.com/bevacqua/woofmark/blob/master/dist/woofmark.js#L3488-3490
Somehow, your script failed to replace the rmarkers
.
You script failed to find the rmarker
because the page has been _refreshed_ and a new code is generated.
You should probably create an open tag and an end tag wrapping the code, so as to use regex to find it even if the code is irrelevant, e.g.
WoofmarkSelectionOpenMarker{{abcdefgh}} WoofmarkSelectionCloseMarker{{abcdefgh}}
https://github.com/bevacqua/woofmark/blob/master/dist/woofmark.js#L3456
Could you create a PR with the fix?
Replacing https://github.com/bevacqua/woofmark/blob/master/dist/woofmark.js#L3457-3459
with
var code = Math.random().toString(18).substr(2).replace(/\d+/g, '');
var open = 'WoofmarkSelectionOpenMarker{{' + code + '}}';
var close = 'WoofmarkSelectionCloseMarker{{' + code + '}}';
//var rmarkers = new RegExp(open + '|' + close, 'g');
var rmarkers = new RegExp('WoofmarkSelectionOpenMarker{{.+}}|WoofmarkSelectionCloseMarker{{.+}}', 'g');
solves the problem with refreshing the page in WYSIWYG mode, but I'm sure the code is there for a reason. If the regex matches any code, would it break the program?
Sorry, but I'm really no expert at JavaScript
I can't reproduce this either. Please help me reproduce
Similar to the other issue, I'm using Nightly, but Firefox should do.
space
.WoofmarkSelectionOpenMarkerefcdagfWoofmarkSelectionCloseMarkerefcdagfspace
@bevacqua I discovered that, on Firefox, it tried to keep the content, but on Chrome, the editor resets. Perhaps you haven't considered Firefox for testing?
I haven't done thorough testing on Firefox. Can you work out a fix for this issue?
@bevacqua If you look up, I've tried a fix for the problem, accounting that Firefox tries to save what was inputted. I wrapped the code with brackets so they can be detected and removed.
Sorry, but I'm really no expert in JavaScript, my "fixes" might just be silly codings :(
The input autocompletion is probably the culprit here. You can try disabling the autocompletion as per the linked article if you do not want the browser to "remember" the modified content on refresh.
I have been testing the software and I think I've found a bug?
I'm using Firefox Nightly 41,
Problem: Texts unexpected appended to editor upon refresh
Expected Text:
space
Resulted Text: First time.
spaceWoofmarkSelectionOpenMarkergbdhcWoofmarkSelectionCloseMarkergbdhc
Second time.spaceWoofmarkSelectionOpenMarkerecaacbhWoofmarkSelectionCloseMarkerecaacbh
Procedures: Input
space
or any text into WYSIWYG mode, refresh page.Analysis: The string "
WoofmarkSelectionOpenMarker
" + code string + "WoofmarkSelectionCloseMarker
" + repeated code string is appended to text upon every refresh on WYSIWYG mode with some text input.