Ticket #12464: 12464.2.diff

File 12464.2.diff, 1.3 KB (added by ericlewis, 15 months ago)

Fix replace ' instead of ' for single quotes in [caption] string

Line 
1Index: editor_plugin.dev.js
2===================================================================
3--- editor_plugin.dev.js        (revision 19932)
4+++ editor_plugin.dev.js        (working copy)
5@@ -134,12 +134,13 @@
6                                id = b.match(/id=['"]([^'"]+)/i);
7                                cls = b.match(/align=['"]([^'"]+)/i);
8                                w = b.match(/width=['"]([0-9]+)/);
9-                               cap = b.match(/caption=['"]([^'"]+)/i);
10+                               cap = b.match(/caption=["]([^"]+)/i);
11 
12                                id = ( id && id[1] ) ? id[1] : '';
13                                cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
14                                w = ( w && w[1] ) ? w[1] : '';
15                                cap = ( cap && cap[1] ) ? cap[1] : '';
16+                               cap = cap.replace(/'|\\'/g, "'");
17                                if ( ! w || ! cap ) return c;
18                               
19                                div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
20@@ -163,8 +164,9 @@
21 
22                                if ( ! w || ! cap ) return c;
23                                cls = cls.match(/align[^ '"]+/) || 'alignnone';
24-                               cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
25 
26+                               cap = cap.replace(/<[^a|\/a]\S[^<>]*>/gi, '').replace(/["]/g, "'");
27+
28                                return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
29                        });
30                },
31@@ -230,4 +232,4 @@
32        });
33 
34        tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
35-})();
36+})();
37\ No newline at end of file