diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-01-20 00:55:51 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-01-20 00:55:51 +0100 |
commit | c63493c899de714b05b0521bb38aab60d19030ef (patch) | |
tree | fcb2b261afa0f3c2bd6b48929b64724c71192bae /sources/plugins/htmlwriter/samples | |
download | ludivine-ckeditor-component-c63493c899de714b05b0521bb38aab60d19030ef.tar.gz ludivine-ckeditor-component-c63493c899de714b05b0521bb38aab60d19030ef.tar.zst ludivine-ckeditor-component-c63493c899de714b05b0521bb38aab60d19030ef.zip |
Validation initiale4.6.2.1
Diffstat (limited to 'sources/plugins/htmlwriter/samples')
-rw-r--r-- | sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.fla | bin | 0 -> 85504 bytes | |||
-rw-r--r-- | sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.swf | bin | 0 -> 15571 bytes | |||
-rw-r--r-- | sources/plugins/htmlwriter/samples/assets/outputforflash/swfobject.js | 5 | ||||
-rw-r--r-- | sources/plugins/htmlwriter/samples/outputforflash.html | 283 | ||||
-rw-r--r-- | sources/plugins/htmlwriter/samples/outputhtml.html | 224 |
5 files changed, 512 insertions, 0 deletions
diff --git a/sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.fla b/sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.fla new file mode 100644 index 0000000..27e68cc --- /dev/null +++ b/sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.fla | |||
Binary files differ | |||
diff --git a/sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.swf b/sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.swf new file mode 100644 index 0000000..dbe17b6 --- /dev/null +++ b/sources/plugins/htmlwriter/samples/assets/outputforflash/outputforflash.swf | |||
Binary files differ | |||
diff --git a/sources/plugins/htmlwriter/samples/assets/outputforflash/swfobject.js b/sources/plugins/htmlwriter/samples/assets/outputforflash/swfobject.js new file mode 100644 index 0000000..90cdcc9 --- /dev/null +++ b/sources/plugins/htmlwriter/samples/assets/outputforflash/swfobject.js | |||
@@ -0,0 +1,5 @@ | |||
1 | | ||
2 | /* SWFObject v2.2 <http://code.google.com/p/swfobject/> | ||
3 | is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> | ||
4 | */ | ||
5 | var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}(); | ||
diff --git a/sources/plugins/htmlwriter/samples/outputforflash.html b/sources/plugins/htmlwriter/samples/outputforflash.html new file mode 100644 index 0000000..f72616d --- /dev/null +++ b/sources/plugins/htmlwriter/samples/outputforflash.html | |||
@@ -0,0 +1,283 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- | ||
3 | Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
4 | For licensing, see LICENSE.md or http://ckeditor.com/license | ||
5 | --> | ||
6 | <html> | ||
7 | <head> | ||
8 | <meta charset="utf-8"> | ||
9 | <title>Output for Flash — CKEditor Sample</title> | ||
10 | <script src="../../../ckeditor.js"></script> | ||
11 | <script src="../../../samples/old/sample.js"></script> | ||
12 | <script src="assets/outputforflash/swfobject.js"></script> | ||
13 | <link href="../../../samples/old/sample.css" rel="stylesheet"> | ||
14 | <meta name="ckeditor-sample-required-plugins" content="sourcearea"> | ||
15 | <meta name="ckeditor-sample-name" content="Output for Flash"> | ||
16 | <meta name="ckeditor-sample-group" content="Advanced Samples"> | ||
17 | <meta name="ckeditor-sample-description" content="Configuring CKEditor to produce HTML code that can be used with Adobe Flash."> | ||
18 | <style> | ||
19 | |||
20 | .alert | ||
21 | { | ||
22 | background: #ffa84c; | ||
23 | padding: 10px 15px; | ||
24 | font-weight: bold; | ||
25 | display: block; | ||
26 | margin-bottom: 20px; | ||
27 | } | ||
28 | |||
29 | </style> | ||
30 | </head> | ||
31 | <body> | ||
32 | <h1 class="samples"> | ||
33 | <a href="../../../samples/old/index.html">CKEditor Samples</a> » Producing Flash Compliant HTML Output | ||
34 | </h1> | ||
35 | <div class="warning deprecated"> | ||
36 | This sample is not maintained anymore. Check out the <a href="http://sdk.ckeditor.com/">brand new samples in CKEditor SDK</a>. | ||
37 | </div> | ||
38 | <div class="description"> | ||
39 | <p> | ||
40 | This sample shows how to configure CKEditor to output | ||
41 | HTML code that can be used with | ||
42 | <a class="samples" href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000922.html"> | ||
43 | Adobe Flash</a>. | ||
44 | The code will contain a subset of standard HTML elements like <code><b></code>, | ||
45 | <code><i></code>, and <code><p></code> as well as HTML attributes. | ||
46 | </p> | ||
47 | <p> | ||
48 | To add a CKEditor instance outputting Flash compliant HTML code, load the editor using a standard | ||
49 | JavaScript call, and define CKEditor features to use HTML elements and attributes. | ||
50 | </p> | ||
51 | <p> | ||
52 | For details on how to create this setup check the source code of this sample page. | ||
53 | </p> | ||
54 | </div> | ||
55 | <p> | ||
56 | To see how it works, create some content in the editing area of CKEditor on the left | ||
57 | and send it to the Flash object on the right side of the page by using the | ||
58 | <strong>Send to Flash</strong> button. | ||
59 | </p> | ||
60 | <table style="width: 100%; border-spacing: 0; border-collapse:collapse;"> | ||
61 | <tr> | ||
62 | <td style="width: 100%"> | ||
63 | <textarea cols="80" id="editor1" name="editor1" rows="10"><p><b><font size="18" style="font-size:18px;">Flash and HTML</font></b></p><p>&nbsp;</p><p>It is possible to have <a href="http://ckeditor.com">CKEditor</a> creating content that will be later loaded inside <b>Flash</b> objects and animations.</p><p>&nbsp;</p><p>Flash has a few limitations when dealing with HTML:</p><p>&nbsp;</p><ul><li>It has limited support on tags.</li><li>There is no margin between block elements, like paragraphs.</li></ul></textarea> | ||
64 | <script> | ||
65 | |||
66 | if ( document.location.protocol == 'file:' ) | ||
67 | alert( 'Warning: This samples does not work when loaded from local filesystem' + | ||
68 | 'due to security restrictions implemented in Flash.' + | ||
69 | '\n\nPlease load the sample from a web server instead.' ); | ||
70 | |||
71 | var editor = CKEDITOR.replace( 'editor1', { | ||
72 | /* | ||
73 | * Ensure that htmlwriter plugin, which is required for this sample, is loaded. | ||
74 | */ | ||
75 | extraPlugins: 'htmlwriter', | ||
76 | |||
77 | height: 290, | ||
78 | width: '100%', | ||
79 | toolbar: [ | ||
80 | [ 'Source', '-', 'Bold', 'Italic', 'Underline', '-', 'BulletedList', '-', 'Link', 'Unlink' ], | ||
81 | [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ], | ||
82 | '/', | ||
83 | [ 'Font', 'FontSize' ], | ||
84 | [ 'TextColor', '-', 'About' ] | ||
85 | ], | ||
86 | |||
87 | /* | ||
88 | * Style sheet for the contents | ||
89 | */ | ||
90 | contentsCss: 'body {color:#000; background-color#FFF; font-family: Arial; font-size:80%;} p, ol, ul {margin-top: 0px; margin-bottom: 0px;}', | ||
91 | |||
92 | /* | ||
93 | * Quirks doctype | ||
94 | */ | ||
95 | docType: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', | ||
96 | |||
97 | /* | ||
98 | * Core styles. | ||
99 | */ | ||
100 | coreStyles_bold: { element: 'b' }, | ||
101 | coreStyles_italic: { element: 'i' }, | ||
102 | coreStyles_underline: { element: 'u' }, | ||
103 | |||
104 | /* | ||
105 | * Font face. | ||
106 | */ | ||
107 | |||
108 | // Define the way font elements will be applied to the document. The "font" | ||
109 | // element will be used. | ||
110 | font_style: { | ||
111 | element: 'font', | ||
112 | attributes: { 'face': '#(family)' } | ||
113 | }, | ||
114 | |||
115 | /* | ||
116 | * Font sizes. | ||
117 | */ | ||
118 | |||
119 | // The CSS part of the font sizes isn't used by Flash, it is there to get the | ||
120 | // font rendered correctly in CKEditor. | ||
121 | fontSize_sizes: '8px/8;9px/9;10px/10;11px/11;12px/12;14px/14;16px/16;18px/18;20px/20;22px/22;24px/24;26px/26;28px/28;36px/36;48px/48;72px/72', | ||
122 | fontSize_style: { | ||
123 | element: 'font', | ||
124 | attributes: { 'size': '#(size)' }, | ||
125 | styles: { 'font-size': '#(size)px' } | ||
126 | } , | ||
127 | |||
128 | /* | ||
129 | * Font colors. | ||
130 | */ | ||
131 | colorButton_enableMore: true, | ||
132 | |||
133 | colorButton_foreStyle: { | ||
134 | element: 'font', | ||
135 | attributes: { 'color': '#(color)' } | ||
136 | }, | ||
137 | |||
138 | colorButton_backStyle: { | ||
139 | element: 'font', | ||
140 | styles: { 'background-color': '#(color)' } | ||
141 | }, | ||
142 | |||
143 | on: { 'instanceReady': configureFlashOutput } | ||
144 | }); | ||
145 | |||
146 | /* | ||
147 | * Adjust the behavior of the dataProcessor to match the | ||
148 | * requirements of Flash | ||
149 | */ | ||
150 | function configureFlashOutput( ev ) { | ||
151 | var editor = ev.editor, | ||
152 | dataProcessor = editor.dataProcessor, | ||
153 | htmlFilter = dataProcessor && dataProcessor.htmlFilter; | ||
154 | |||
155 | // Out self closing tags the HTML4 way, like <br>. | ||
156 | dataProcessor.writer.selfClosingEnd = '>'; | ||
157 | |||
158 | // Make output formatting match Flash expectations | ||
159 | var dtd = CKEDITOR.dtd; | ||
160 | for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { | ||
161 | dataProcessor.writer.setRules( e, { | ||
162 | indent: false, | ||
163 | breakBeforeOpen: false, | ||
164 | breakAfterOpen: false, | ||
165 | breakBeforeClose: false, | ||
166 | breakAfterClose: false | ||
167 | }); | ||
168 | } | ||
169 | dataProcessor.writer.setRules( 'br', { | ||
170 | indent: false, | ||
171 | breakBeforeOpen: false, | ||
172 | breakAfterOpen: false, | ||
173 | breakBeforeClose: false, | ||
174 | breakAfterClose: false | ||
175 | }); | ||
176 | |||
177 | // Output properties as attributes, not styles. | ||
178 | htmlFilter.addRules( { | ||
179 | elements: { | ||
180 | $: function( element ) { | ||
181 | var style, match, width, height, align; | ||
182 | |||
183 | // Output dimensions of images as width and height | ||
184 | if ( element.name == 'img' ) { | ||
185 | style = element.attributes.style; | ||
186 | |||
187 | if ( style ) { | ||
188 | // Get the width from the style. | ||
189 | match = ( /(?:^|\s)width\s*:\s*(\d+)px/i ).exec( style ); | ||
190 | width = match && match[1]; | ||
191 | |||
192 | // Get the height from the style. | ||
193 | match = ( /(?:^|\s)height\s*:\s*(\d+)px/i ).exec( style ); | ||
194 | height = match && match[1]; | ||
195 | |||
196 | if ( width ) { | ||
197 | element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' ); | ||
198 | element.attributes.width = width; | ||
199 | } | ||
200 | |||
201 | if ( height ) { | ||
202 | element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' ); | ||
203 | element.attributes.height = height; | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | // Output alignment of paragraphs using align | ||
209 | if ( element.name == 'p' ) { | ||
210 | style = element.attributes.style; | ||
211 | |||
212 | if ( style ) { | ||
213 | // Get the align from the style. | ||
214 | match = ( /(?:^|\s)text-align\s*:\s*(\w*);?/i ).exec( style ); | ||
215 | align = match && match[1]; | ||
216 | |||
217 | if ( align ) { | ||
218 | element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' ); | ||
219 | element.attributes.align = align; | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | |||
224 | if ( element.attributes.style === '' ) | ||
225 | delete element.attributes.style; | ||
226 | |||
227 | return element; | ||
228 | } | ||
229 | } | ||
230 | }); | ||
231 | } | ||
232 | |||
233 | function sendToFlash() { | ||
234 | var html = CKEDITOR.instances.editor1.getData() ; | ||
235 | |||
236 | // Quick fix for link color. | ||
237 | html = html.replace( /<a /g, '<font color="#0000FF"><u><a ' ) | ||
238 | html = html.replace( /<\/a>/g, '</a></u></font>' ) | ||
239 | |||
240 | var flash = document.getElementById( 'ckFlashContainer' ) ; | ||
241 | flash.setData( html ) ; | ||
242 | } | ||
243 | |||
244 | CKEDITOR.domReady( function() { | ||
245 | if ( !swfobject.hasFlashPlayerVersion( '8' ) ) { | ||
246 | CKEDITOR.dom.element.createFromHtml( '<span class="alert">' + | ||
247 | 'At least Adobe Flash Player 8 is required to run this sample. ' + | ||
248 | 'You can download it from <a href="http://get.adobe.com/flashplayer">Adobe\'s website</a>.' + | ||
249 | '</span>' ).insertBefore( editor.element ); | ||
250 | } | ||
251 | |||
252 | swfobject.embedSWF( | ||
253 | 'assets/outputforflash/outputforflash.swf', | ||
254 | 'ckFlashContainer', | ||
255 | '550', | ||
256 | '400', | ||
257 | '8', | ||
258 | { wmode: 'transparent' } | ||
259 | ); | ||
260 | }); | ||
261 | |||
262 | </script> | ||
263 | <p> | ||
264 | <input type="button" value="Send to Flash" onclick="sendToFlash();"> | ||
265 | </p> | ||
266 | </td> | ||
267 | <td style="vertical-align: top; padding-left: 20px"> | ||
268 | <div id="ckFlashContainer"></div> | ||
269 | </td> | ||
270 | </tr> | ||
271 | </table> | ||
272 | <div id="footer"> | ||
273 | <hr> | ||
274 | <p> | ||
275 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> | ||
276 | </p> | ||
277 | <p id="copy"> | ||
278 | Copyright © 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico | ||
279 | Knabben. All rights reserved. | ||
280 | </p> | ||
281 | </div> | ||
282 | </body> | ||
283 | </html> | ||
diff --git a/sources/plugins/htmlwriter/samples/outputhtml.html b/sources/plugins/htmlwriter/samples/outputhtml.html new file mode 100644 index 0000000..a433025 --- /dev/null +++ b/sources/plugins/htmlwriter/samples/outputhtml.html | |||
@@ -0,0 +1,224 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- | ||
3 | Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
4 | For licensing, see LICENSE.md or http://ckeditor.com/license | ||
5 | --> | ||
6 | <html> | ||
7 | <head> | ||
8 | <meta charset="utf-8"> | ||
9 | <title>HTML Compliant Output — CKEditor Sample</title> | ||
10 | <script src="../../../ckeditor.js"></script> | ||
11 | <script src="../../../samples/old/sample.js"></script> | ||
12 | <link href="../../../samples/old/sample.css" rel="stylesheet"> | ||
13 | <meta name="ckeditor-sample-required-plugins" content="sourcearea"> | ||
14 | <meta name="ckeditor-sample-name" content="Output HTML"> | ||
15 | <meta name="ckeditor-sample-group" content="Advanced Samples"> | ||
16 | <meta name="ckeditor-sample-description" content="Configuring CKEditor to produce legacy HTML 4 code."> | ||
17 | </head> | ||
18 | <body> | ||
19 | <h1 class="samples"> | ||
20 | <a href="../../../samples/old/index.html">CKEditor Samples</a> » Producing HTML Compliant Output | ||
21 | </h1> | ||
22 | <div class="warning deprecated"> | ||
23 | This sample is not maintained anymore. Check out the <a href="http://sdk.ckeditor.com/">brand new samples in CKEditor SDK</a>. | ||
24 | </div> | ||
25 | <div class="description"> | ||
26 | <p> | ||
27 | This sample shows how to configure CKEditor to output valid | ||
28 | <a class="samples" href="http://www.w3.org/TR/html401/">HTML 4.01</a> code. | ||
29 | Traditional HTML elements like <code><b></code>, | ||
30 | <code><i></code>, and <code><font></code> are used in place of | ||
31 | <code><strong></code>, <code><em></code>, and CSS styles. | ||
32 | </p> | ||
33 | <p> | ||
34 | To add a CKEditor instance outputting legacy HTML 4.01 code, load the editor using a standard | ||
35 | JavaScript call, and define CKEditor features to use the HTML compliant elements and attributes. | ||
36 | </p> | ||
37 | <p> | ||
38 | A snippet of the configuration code can be seen below; check the source of this page for | ||
39 | full definition: | ||
40 | </p> | ||
41 | <pre class="samples"> | ||
42 | CKEDITOR.replace( '<em>textarea_id</em>', { | ||
43 | coreStyles_bold: { element: 'b' }, | ||
44 | coreStyles_italic: { element: 'i' }, | ||
45 | |||
46 | fontSize_style: { | ||
47 | element: 'font', | ||
48 | attributes: { 'size': '#(size)' } | ||
49 | } | ||
50 | |||
51 | ... | ||
52 | });</pre> | ||
53 | </div> | ||
54 | <form action="../../../samples/sample_posteddata.php" method="post"> | ||
55 | <p> | ||
56 | <label for="editor1"> | ||
57 | Editor 1: | ||
58 | </label> | ||
59 | <textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <b>sample text</b>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea> | ||
60 | <script> | ||
61 | |||
62 | CKEDITOR.replace( 'editor1', { | ||
63 | /* | ||
64 | * Ensure that htmlwriter plugin, which is required for this sample, is loaded. | ||
65 | */ | ||
66 | extraPlugins: 'htmlwriter', | ||
67 | |||
68 | /* | ||
69 | * Style sheet for the contents | ||
70 | */ | ||
71 | contentsCss: 'body {color:#000; background-color#:FFF;}', | ||
72 | |||
73 | /* | ||
74 | * Simple HTML5 doctype | ||
75 | */ | ||
76 | docType: '<!DOCTYPE HTML>', | ||
77 | |||
78 | /* | ||
79 | * Allowed content rules which beside limiting allowed HTML | ||
80 | * will also take care of transforming styles to attributes | ||
81 | * (currently only for img - see transformation rules defined below). | ||
82 | * | ||
83 | * Read more: http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter | ||
84 | */ | ||
85 | allowedContent: | ||
86 | 'h1 h2 h3 p pre[align]; ' + | ||
87 | 'blockquote code kbd samp var del ins cite q b i u strike ul ol li hr table tbody tr td th caption; ' + | ||
88 | 'img[!src,alt,align,width,height]; font[!face]; font[!family]; font[!color]; font[!size]; font{!background-color}; a[!href]; a[!name]', | ||
89 | |||
90 | /* | ||
91 | * Core styles. | ||
92 | */ | ||
93 | coreStyles_bold: { element: 'b' }, | ||
94 | coreStyles_italic: { element: 'i' }, | ||
95 | coreStyles_underline: { element: 'u' }, | ||
96 | coreStyles_strike: { element: 'strike' }, | ||
97 | |||
98 | /* | ||
99 | * Font face. | ||
100 | */ | ||
101 | |||
102 | // Define the way font elements will be applied to the document. | ||
103 | // The "font" element will be used. | ||
104 | font_style: { | ||
105 | element: 'font', | ||
106 | attributes: { 'face': '#(family)' } | ||
107 | }, | ||
108 | |||
109 | /* | ||
110 | * Font sizes. | ||
111 | */ | ||
112 | fontSize_sizes: 'xx-small/1;x-small/2;small/3;medium/4;large/5;x-large/6;xx-large/7', | ||
113 | fontSize_style: { | ||
114 | element: 'font', | ||
115 | attributes: { 'size': '#(size)' } | ||
116 | }, | ||
117 | |||
118 | /* | ||
119 | * Font colors. | ||
120 | */ | ||
121 | |||
122 | colorButton_foreStyle: { | ||
123 | element: 'font', | ||
124 | attributes: { 'color': '#(color)' } | ||
125 | }, | ||
126 | |||
127 | colorButton_backStyle: { | ||
128 | element: 'font', | ||
129 | styles: { 'background-color': '#(color)' } | ||
130 | }, | ||
131 | |||
132 | /* | ||
133 | * Styles combo. | ||
134 | */ | ||
135 | stylesSet: [ | ||
136 | { name: 'Computer Code', element: 'code' }, | ||
137 | { name: 'Keyboard Phrase', element: 'kbd' }, | ||
138 | { name: 'Sample Text', element: 'samp' }, | ||
139 | { name: 'Variable', element: 'var' }, | ||
140 | { name: 'Deleted Text', element: 'del' }, | ||
141 | { name: 'Inserted Text', element: 'ins' }, | ||
142 | { name: 'Cited Work', element: 'cite' }, | ||
143 | { name: 'Inline Quotation', element: 'q' } | ||
144 | ], | ||
145 | |||
146 | on: { | ||
147 | pluginsLoaded: configureTransformations, | ||
148 | loaded: configureHtmlWriter | ||
149 | } | ||
150 | }); | ||
151 | |||
152 | /* | ||
153 | * Add missing content transformations. | ||
154 | */ | ||
155 | function configureTransformations( evt ) { | ||
156 | var editor = evt.editor; | ||
157 | |||
158 | editor.dataProcessor.htmlFilter.addRules( { | ||
159 | attributes: { | ||
160 | style: function( value, element ) { | ||
161 | // Return #RGB for background and border colors | ||
162 | return CKEDITOR.tools.convertRgbToHex( value ); | ||
163 | } | ||
164 | } | ||
165 | } ); | ||
166 | |||
167 | // Default automatic content transformations do not yet take care of | ||
168 | // align attributes on blocks, so we need to add our own transformation rules. | ||
169 | function alignToAttribute( element ) { | ||
170 | if ( element.styles[ 'text-align' ] ) { | ||
171 | element.attributes.align = element.styles[ 'text-align' ]; | ||
172 | delete element.styles[ 'text-align' ]; | ||
173 | } | ||
174 | } | ||
175 | editor.filter.addTransformations( [ | ||
176 | [ { element: 'p', right: alignToAttribute } ], | ||
177 | [ { element: 'h1', right: alignToAttribute } ], | ||
178 | [ { element: 'h2', right: alignToAttribute } ], | ||
179 | [ { element: 'h3', right: alignToAttribute } ], | ||
180 | [ { element: 'pre', right: alignToAttribute } ] | ||
181 | ] ); | ||
182 | } | ||
183 | |||
184 | /* | ||
185 | * Adjust the behavior of htmlWriter to make it output HTML like FCKeditor. | ||
186 | */ | ||
187 | function configureHtmlWriter( evt ) { | ||
188 | var editor = evt.editor, | ||
189 | dataProcessor = editor.dataProcessor; | ||
190 | |||
191 | // Out self closing tags the HTML4 way, like <br>. | ||
192 | dataProcessor.writer.selfClosingEnd = '>'; | ||
193 | |||
194 | // Make output formatting behave similar to FCKeditor. | ||
195 | var dtd = CKEDITOR.dtd; | ||
196 | for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { | ||
197 | dataProcessor.writer.setRules( e, { | ||
198 | indent: true, | ||
199 | breakBeforeOpen: true, | ||
200 | breakAfterOpen: false, | ||
201 | breakBeforeClose: !dtd[ e ][ '#' ], | ||
202 | breakAfterClose: true | ||
203 | }); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | </script> | ||
208 | </p> | ||
209 | <p> | ||
210 | <input type="submit" value="Submit"> | ||
211 | </p> | ||
212 | </form> | ||
213 | <div id="footer"> | ||
214 | <hr> | ||
215 | <p> | ||
216 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> | ||
217 | </p> | ||
218 | <p id="copy"> | ||
219 | Copyright © 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico | ||
220 | Knabben. All rights reserved. | ||
221 | </p> | ||
222 | </div> | ||
223 | </body> | ||
224 | </html> | ||