Fossil SCM

Merge in trunk for test server deployment.

stephan 2021-10-06 02:38 markdown-tagrefs merge
Commit 664b04b2807bf99c93bf70f1dc14b2ebf026274e0862dbcdcbe6c1da3ab23244
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -672,14 +672,16 @@
672672
D.addClassBriefly(e, a, 0, cb);
673673
}
674674
return this;
675675
}
676676
};
677
- if(!D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678
- /* Only the Chrome family supports contenteditable=plaintext-only,
679
- but Chrome is the only engine for which we need this flag: */
680
- D.attr(cs.e.inputField,'contenteditable','true');
677
+ if(D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678
+ cs.$browserHasPlaintextOnly = true;
679
+ }else{
680
+ /* Only the Chrome family supports contenteditable=plaintext-only */
681
+ cs.$browserHasPlaintextOnly = false;
682
+ D.attr(cs.e.inputField,'contenteditable','true');
681683
}
682684
cs.animate.$disabled = true;
683685
F.fetch.beforesend = ()=>cs.ajaxStart();
684686
F.fetch.aftersend = ()=>cs.ajaxEnd();
685687
cs.pageTitleOrig = cs.e.pageTitle.innerText;
@@ -1324,23 +1326,30 @@
13241326
return false;
13251327
}
13261328
/* else continue propagating */
13271329
};
13281330
document.addEventListener('paste', pasteListener, true);
1329
- if(0){
1330
- const onPastePlainText = function(ev){
1331
- var pastedText = undefined;
1332
- if (window.clipboardData && window.clipboardData.getData) { // IE
1333
- pastedText = window.clipboardData.getData('Text');
1334
- }else if (ev.clipboardData && ev.clipboardData.getData) {
1335
- pastedText = ev.clipboardData.getData('text/plain');
1336
- }
1337
- ev.target.textContent += pastedText;
1338
- ev.preventDefault();
1339
- return false;
1340
- };
1341
- Chat.e.inputField.addEventListener('paste', onPastePlainText, false);
1331
+ if(window.Selection && window.Range && !Chat.$browserHasPlaintextOnly){
1332
+ /* Acrobatics to keep *some* installations of Firefox
1333
+ from pasting formatting into contenteditable fields.
1334
+ This also works on Chrome, but chrome has the
1335
+ contenteditable=plaintext-only property which does this
1336
+ for us. */
1337
+ Chat.inputElement().addEventListener(
1338
+ 'paste',
1339
+ function(ev){
1340
+ if (ev.clipboardData && ev.clipboardData.getData) {
1341
+ const pastedText = ev.clipboardData.getData('text/plain');
1342
+ const selection = window.getSelection();
1343
+ if (!selection.rangeCount) return false;
1344
+ selection.deleteFromDocument(/*remove selected content*/);
1345
+ selection.getRangeAt(0).insertNode(document.createTextNode(pastedText));
1346
+ selection.collapseToEnd(/*deselect pasted text and set cursor at the end*/);
1347
+ ev.preventDefault();
1348
+ return false;
1349
+ }
1350
+ }, false);
13421351
}
13431352
const noDragDropEvents = function(ev){
13441353
/* contenteditable tries to do its own thing with dropped data,
13451354
which is not compatible with how we use it, so... */
13461355
ev.dataTransfer.effectAllowed = 'none';
13471356
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -672,14 +672,16 @@
672 D.addClassBriefly(e, a, 0, cb);
673 }
674 return this;
675 }
676 };
677 if(!D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678 /* Only the Chrome family supports contenteditable=plaintext-only,
679 but Chrome is the only engine for which we need this flag: */
680 D.attr(cs.e.inputField,'contenteditable','true');
 
 
681 }
682 cs.animate.$disabled = true;
683 F.fetch.beforesend = ()=>cs.ajaxStart();
684 F.fetch.aftersend = ()=>cs.ajaxEnd();
685 cs.pageTitleOrig = cs.e.pageTitle.innerText;
@@ -1324,23 +1326,30 @@
1324 return false;
1325 }
1326 /* else continue propagating */
1327 };
1328 document.addEventListener('paste', pasteListener, true);
1329 if(0){
1330 const onPastePlainText = function(ev){
1331 var pastedText = undefined;
1332 if (window.clipboardData && window.clipboardData.getData) { // IE
1333 pastedText = window.clipboardData.getData('Text');
1334 }else if (ev.clipboardData && ev.clipboardData.getData) {
1335 pastedText = ev.clipboardData.getData('text/plain');
1336 }
1337 ev.target.textContent += pastedText;
1338 ev.preventDefault();
1339 return false;
1340 };
1341 Chat.e.inputField.addEventListener('paste', onPastePlainText, false);
 
 
 
 
 
 
 
1342 }
1343 const noDragDropEvents = function(ev){
1344 /* contenteditable tries to do its own thing with dropped data,
1345 which is not compatible with how we use it, so... */
1346 ev.dataTransfer.effectAllowed = 'none';
1347
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -672,14 +672,16 @@
672 D.addClassBriefly(e, a, 0, cb);
673 }
674 return this;
675 }
676 };
677 if(D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678 cs.$browserHasPlaintextOnly = true;
679 }else{
680 /* Only the Chrome family supports contenteditable=plaintext-only */
681 cs.$browserHasPlaintextOnly = false;
682 D.attr(cs.e.inputField,'contenteditable','true');
683 }
684 cs.animate.$disabled = true;
685 F.fetch.beforesend = ()=>cs.ajaxStart();
686 F.fetch.aftersend = ()=>cs.ajaxEnd();
687 cs.pageTitleOrig = cs.e.pageTitle.innerText;
@@ -1324,23 +1326,30 @@
1326 return false;
1327 }
1328 /* else continue propagating */
1329 };
1330 document.addEventListener('paste', pasteListener, true);
1331 if(window.Selection && window.Range && !Chat.$browserHasPlaintextOnly){
1332 /* Acrobatics to keep *some* installations of Firefox
1333 from pasting formatting into contenteditable fields.
1334 This also works on Chrome, but chrome has the
1335 contenteditable=plaintext-only property which does this
1336 for us. */
1337 Chat.inputElement().addEventListener(
1338 'paste',
1339 function(ev){
1340 if (ev.clipboardData && ev.clipboardData.getData) {
1341 const pastedText = ev.clipboardData.getData('text/plain');
1342 const selection = window.getSelection();
1343 if (!selection.rangeCount) return false;
1344 selection.deleteFromDocument(/*remove selected content*/);
1345 selection.getRangeAt(0).insertNode(document.createTextNode(pastedText));
1346 selection.collapseToEnd(/*deselect pasted text and set cursor at the end*/);
1347 ev.preventDefault();
1348 return false;
1349 }
1350 }, false);
1351 }
1352 const noDragDropEvents = function(ev){
1353 /* contenteditable tries to do its own thing with dropped data,
1354 which is not compatible with how we use it, so... */
1355 ev.dataTransfer.effectAllowed = 'none';
1356
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -672,14 +672,16 @@
672672
D.addClassBriefly(e, a, 0, cb);
673673
}
674674
return this;
675675
}
676676
};
677
- if(!D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678
- /* Only the Chrome family supports contenteditable=plaintext-only,
679
- but Chrome is the only engine for which we need this flag: */
680
- D.attr(cs.e.inputField,'contenteditable','true');
677
+ if(D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678
+ cs.$browserHasPlaintextOnly = true;
679
+ }else{
680
+ /* Only the Chrome family supports contenteditable=plaintext-only */
681
+ cs.$browserHasPlaintextOnly = false;
682
+ D.attr(cs.e.inputField,'contenteditable','true');
681683
}
682684
cs.animate.$disabled = true;
683685
F.fetch.beforesend = ()=>cs.ajaxStart();
684686
F.fetch.aftersend = ()=>cs.ajaxEnd();
685687
cs.pageTitleOrig = cs.e.pageTitle.innerText;
@@ -1324,23 +1326,30 @@
13241326
return false;
13251327
}
13261328
/* else continue propagating */
13271329
};
13281330
document.addEventListener('paste', pasteListener, true);
1329
- if(0){
1330
- const onPastePlainText = function(ev){
1331
- var pastedText = undefined;
1332
- if (window.clipboardData && window.clipboardData.getData) { // IE
1333
- pastedText = window.clipboardData.getData('Text');
1334
- }else if (ev.clipboardData && ev.clipboardData.getData) {
1335
- pastedText = ev.clipboardData.getData('text/plain');
1336
- }
1337
- ev.target.textContent += pastedText;
1338
- ev.preventDefault();
1339
- return false;
1340
- };
1341
- Chat.e.inputField.addEventListener('paste', onPastePlainText, false);
1331
+ if(window.Selection && window.Range && !Chat.$browserHasPlaintextOnly){
1332
+ /* Acrobatics to keep *some* installations of Firefox
1333
+ from pasting formatting into contenteditable fields.
1334
+ This also works on Chrome, but chrome has the
1335
+ contenteditable=plaintext-only property which does this
1336
+ for us. */
1337
+ Chat.inputElement().addEventListener(
1338
+ 'paste',
1339
+ function(ev){
1340
+ if (ev.clipboardData && ev.clipboardData.getData) {
1341
+ const pastedText = ev.clipboardData.getData('text/plain');
1342
+ const selection = window.getSelection();
1343
+ if (!selection.rangeCount) return false;
1344
+ selection.deleteFromDocument(/*remove selected content*/);
1345
+ selection.getRangeAt(0).insertNode(document.createTextNode(pastedText));
1346
+ selection.collapseToEnd(/*deselect pasted text and set cursor at the end*/);
1347
+ ev.preventDefault();
1348
+ return false;
1349
+ }
1350
+ }, false);
13421351
}
13431352
const noDragDropEvents = function(ev){
13441353
/* contenteditable tries to do its own thing with dropped data,
13451354
which is not compatible with how we use it, so... */
13461355
ev.dataTransfer.effectAllowed = 'none';
13471356
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -672,14 +672,16 @@
672 D.addClassBriefly(e, a, 0, cb);
673 }
674 return this;
675 }
676 };
677 if(!D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678 /* Only the Chrome family supports contenteditable=plaintext-only,
679 but Chrome is the only engine for which we need this flag: */
680 D.attr(cs.e.inputField,'contenteditable','true');
 
 
681 }
682 cs.animate.$disabled = true;
683 F.fetch.beforesend = ()=>cs.ajaxStart();
684 F.fetch.aftersend = ()=>cs.ajaxEnd();
685 cs.pageTitleOrig = cs.e.pageTitle.innerText;
@@ -1324,23 +1326,30 @@
1324 return false;
1325 }
1326 /* else continue propagating */
1327 };
1328 document.addEventListener('paste', pasteListener, true);
1329 if(0){
1330 const onPastePlainText = function(ev){
1331 var pastedText = undefined;
1332 if (window.clipboardData && window.clipboardData.getData) { // IE
1333 pastedText = window.clipboardData.getData('Text');
1334 }else if (ev.clipboardData && ev.clipboardData.getData) {
1335 pastedText = ev.clipboardData.getData('text/plain');
1336 }
1337 ev.target.textContent += pastedText;
1338 ev.preventDefault();
1339 return false;
1340 };
1341 Chat.e.inputField.addEventListener('paste', onPastePlainText, false);
 
 
 
 
 
 
 
1342 }
1343 const noDragDropEvents = function(ev){
1344 /* contenteditable tries to do its own thing with dropped data,
1345 which is not compatible with how we use it, so... */
1346 ev.dataTransfer.effectAllowed = 'none';
1347
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -672,14 +672,16 @@
672 D.addClassBriefly(e, a, 0, cb);
673 }
674 return this;
675 }
676 };
677 if(D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
678 cs.$browserHasPlaintextOnly = true;
679 }else{
680 /* Only the Chrome family supports contenteditable=plaintext-only */
681 cs.$browserHasPlaintextOnly = false;
682 D.attr(cs.e.inputField,'contenteditable','true');
683 }
684 cs.animate.$disabled = true;
685 F.fetch.beforesend = ()=>cs.ajaxStart();
686 F.fetch.aftersend = ()=>cs.ajaxEnd();
687 cs.pageTitleOrig = cs.e.pageTitle.innerText;
@@ -1324,23 +1326,30 @@
1326 return false;
1327 }
1328 /* else continue propagating */
1329 };
1330 document.addEventListener('paste', pasteListener, true);
1331 if(window.Selection && window.Range && !Chat.$browserHasPlaintextOnly){
1332 /* Acrobatics to keep *some* installations of Firefox
1333 from pasting formatting into contenteditable fields.
1334 This also works on Chrome, but chrome has the
1335 contenteditable=plaintext-only property which does this
1336 for us. */
1337 Chat.inputElement().addEventListener(
1338 'paste',
1339 function(ev){
1340 if (ev.clipboardData && ev.clipboardData.getData) {
1341 const pastedText = ev.clipboardData.getData('text/plain');
1342 const selection = window.getSelection();
1343 if (!selection.rangeCount) return false;
1344 selection.deleteFromDocument(/*remove selected content*/);
1345 selection.getRangeAt(0).insertNode(document.createTextNode(pastedText));
1346 selection.collapseToEnd(/*deselect pasted text and set cursor at the end*/);
1347 ev.preventDefault();
1348 return false;
1349 }
1350 }, false);
1351 }
1352 const noDragDropEvents = function(ev){
1353 /* contenteditable tries to do its own thing with dropped data,
1354 which is not compatible with how we use it, so... */
1355 ev.dataTransfer.effectAllowed = 'none';
1356
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -214,11 +214,11 @@
214214
}else{
215215
isErr = 2;
216216
if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
217217
blob_append(pOut, "<pre class='error'>\n", 20);
218218
}
219
- blob_append(pOut, zOut, -1);
219
+ blob_appendf(pOut, "%h", zOut);
220220
if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
221221
blob_append(pOut, "\n</pre>\n", 8);
222222
}
223223
}
224224
fossil_free(zOut);
225225
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -214,11 +214,11 @@
214 }else{
215 isErr = 2;
216 if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
217 blob_append(pOut, "<pre class='error'>\n", 20);
218 }
219 blob_append(pOut, zOut, -1);
220 if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
221 blob_append(pOut, "\n</pre>\n", 8);
222 }
223 }
224 fossil_free(zOut);
225
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -214,11 +214,11 @@
214 }else{
215 isErr = 2;
216 if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
217 blob_append(pOut, "<pre class='error'>\n", 20);
218 }
219 blob_appendf(pOut, "%h", zOut);
220 if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
221 blob_append(pOut, "\n</pre>\n", 8);
222 }
223 }
224 fossil_free(zOut);
225

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button