Fossil SCM
Wiki wysiwyg formatting for IE 7/8/9/10. Patch by Warren Young.
Commit
8dfbcb457a6a6233682029f646f0fa03c38d6240
Parent
75c4808653d0c50…
1 file changed
+8
-1
+8
-1
| --- src/wysiwyg.c | ||
| +++ src/wysiwyg.c | ||
| @@ -251,11 +251,18 @@ | ||
| 251 | 251 | @ } |
| 252 | 252 | @ |
| 253 | 253 | @ /* Run the editing command if in WYSIWYG mode */ |
| 254 | 254 | @ function formatDoc(sCmd, sValue) { |
| 255 | 255 | @ 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 | + @ } | |
| 257 | 264 | @ document.execCommand(sCmd, false, sValue); |
| 258 | 265 | @ oDoc.focus(); |
| 259 | 266 | @ } |
| 260 | 267 | @ } |
| 261 | 268 | @ |
| 262 | 269 |
| --- 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 |