Fossil SCM

Wiki wysiwyg formatting for IE 7/8/9/10. Patch by Warren Young.

jan.nijtmans 2014-08-13 07:06 trunk
Commit 8dfbcb457a6a6233682029f646f0fa03c38d6240
1 file changed +8 -1
+8 -1
--- src/wysiwyg.c
+++ src/wysiwyg.c
@@ -251,11 +251,18 @@
251251
@ }
252252
@
253253
@ /* Run the editing command if in WYSIWYG mode */
254254
@ function formatDoc(sCmd, sValue) {
255255
@ if (isWysiwyg()){
256
- @ document.execCommand("styleWithCSS", false, false);
256
+ @ try {
257
+ @ // First try the draft standard W3C way, which works on non-IE
258
+ @ // for a long time, and now finally supported in IE11+.
259
+ @ document.execCommand("styleWithCSS", false, false);
260
+ @ } catch (e) {
261
+ @ try { document.execCommand("useCSS", 0, true); } // IE9/10
262
+ @ catch (e) { } // old IE
263
+ @ }
257264
@ document.execCommand(sCmd, false, sValue);
258265
@ oDoc.focus();
259266
@ }
260267
@ }
261268
@
262269
--- src/wysiwyg.c
+++ src/wysiwyg.c
@@ -251,11 +251,18 @@
251 @ }
252 @
253 @ /* Run the editing command if in WYSIWYG mode */
254 @ function formatDoc(sCmd, sValue) {
255 @ if (isWysiwyg()){
256 @ document.execCommand("styleWithCSS", false, false);
 
 
 
 
 
 
 
257 @ document.execCommand(sCmd, false, sValue);
258 @ oDoc.focus();
259 @ }
260 @ }
261 @
262
--- src/wysiwyg.c
+++ src/wysiwyg.c
@@ -251,11 +251,18 @@
251 @ }
252 @
253 @ /* Run the editing command if in WYSIWYG mode */
254 @ function formatDoc(sCmd, sValue) {
255 @ if (isWysiwyg()){
256 @ try {
257 @ // First try the draft standard W3C way, which works on non-IE
258 @ // for a long time, and now finally supported in IE11+.
259 @ document.execCommand("styleWithCSS", false, false);
260 @ } catch (e) {
261 @ try { document.execCommand("useCSS", 0, true); } // IE9/10
262 @ catch (e) { } // old IE
263 @ }
264 @ document.execCommand(sCmd, false, sValue);
265 @ oDoc.focus();
266 @ }
267 @ }
268 @
269

Keyboard Shortcuts

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