From yuppie at codespeak.net Mon Dec 4 21:13:36 2006 From: yuppie at codespeak.net (yuppie at codespeak.net) Date: Mon, 4 Dec 2006 21:13:36 +0100 (CET) Subject: [kupu-checkins] r35268 - in kupu/trunk/kupu: common doc tests Message-ID: <20061204201336.EF8571007E@code0.codespeak.net> Author: yuppie Date: Mon Dec 4 21:13:33 2006 New Revision: 35268 Modified: kupu/trunk/kupu/common/kupubasetools.js kupu/trunk/kupu/doc/CHANGES.txt kupu/trunk/kupu/tests/run_tests.html kupu/trunk/kupu/tests/test_kupubasetools.js kupu/trunk/kupu/tests/test_kupuhelpers.js Log: - fixed bug in createLink Modified: kupu/trunk/kupu/common/kupubasetools.js ============================================================================== --- kupu/trunk/kupu/common/kupubasetools.js (original) +++ kupu/trunk/kupu/common/kupubasetools.js Mon Dec 4 21:13:33 2006 @@ -1111,6 +1111,11 @@ // the order of the arguments is a bit odd here because of backward // compatibility this.createLink = function(url, type, name, target, title) { + url = url.strip(); + if (!url) { + this.deleteLink(); + return; + }; if (!this.formatSelectedLink(url, type, name, target, title)) { // No links inside or outside. this.editor.execCommand("CreateLink", url); Modified: kupu/trunk/kupu/doc/CHANGES.txt ============================================================================== --- kupu/trunk/kupu/doc/CHANGES.txt (original) +++ kupu/trunk/kupu/doc/CHANGES.txt Mon Dec 4 21:13:33 2006 @@ -2,6 +2,10 @@ Kupu changes ============ +- 1.4 unreleased + + - Fixed a bug where createLink deleted the selected text. + - 1.4 Beta 2 - Paragraph styling now permitted inside a table again (contributed Modified: kupu/trunk/kupu/tests/run_tests.html ============================================================================== --- kupu/trunk/kupu/tests/run_tests.html (original) +++ kupu/trunk/kupu/tests/run_tests.html Mon Dec 4 21:13:33 2006 @@ -67,6 +67,7 @@ testsuite.registerTest(InitKupuCheckersTestCase); testsuite.registerTest(KupuUITestCase); testsuite.registerTest(ImageToolTestCase); + testsuite.registerTest(LinkToolTestCase); testsuite.runSuite(); // global tear down Modified: kupu/trunk/kupu/tests/test_kupubasetools.js ============================================================================== --- kupu/trunk/kupu/tests/test_kupubasetools.js (original) +++ kupu/trunk/kupu/tests/test_kupubasetools.js Mon Dec 4 21:13:33 2006 @@ -291,7 +291,7 @@ KupuUITestCase.prototype = new SelectionTestCase; function ImageToolTestCase() { - this.name = 'KupuUITestCase'; + this.name = 'ImageToolTestCase'; SelectionTestCase.apply(this); this.base_setUp = this.setUp; @@ -325,3 +325,37 @@ }; ImageToolTestCase.prototype = new SelectionTestCase; + +function LinkToolTestCase() { + this.name = 'LinkToolTestCase'; + SelectionTestCase.apply(this); + this.base_setUp = this.setUp; + + this.setUp = function() { + this.base_setUp(); + this.editor = new KupuEditor(this.kupudoc, {}, new DummyLogger()); + this.editor._initialized = true; + this.linktool = new LinkTool(); + this.linktool.editor = this.editor; + }; + + this.test_createLink = function() { + this.body.innerHTML = '
foo bar baz
'; + // select |bar| + this._setSelection(4, null, 7, null, 'bar'); + this.linktool.createLink('http://www.example.org'); + this.assertEquals(this._cleanHtml(this.body.innerHTML), + 'foo bar baz
'); + }; + + this.test_createLinkEmpty = function() { + this.body.innerHTML = 'foo bar baz
'; + // select |bar| + this._setSelection(4, null, 7, null, 'bar'); + this.linktool.createLink(''); + this.assertEquals(this._cleanHtml(this.body.innerHTML), + 'foo bar baz
'); + }; +}; + +LinkToolTestCase.prototype = new SelectionTestCase; Modified: kupu/trunk/kupu/tests/test_kupuhelpers.js ============================================================================== --- kupu/trunk/kupu/tests/test_kupuhelpers.js (original) +++ kupu/trunk/kupu/tests/test_kupuhelpers.js Mon Dec 4 21:13:33 2006 @@ -101,6 +101,8 @@ s = s.toLowerCase().replace(/[\r\n]/g, ""); s = s.replace(/\>[ ]+\<"); s = s.replace(/\/>/g, ">"); + s = s.replace(' style=""', ""); + s = s.replace(" style=''", ""); return s; }; From duncan at codespeak.net Wed Dec 6 10:06:23 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Wed, 6 Dec 2006 10:06:23 +0100 (CET) Subject: [kupu-checkins] r35367 - in kupu/trunk/kupu: doc plone plone/kupu_plone_layer Message-ID: <20061206090623.EB1C410070@code0.codespeak.net> Author: duncan Date: Wed Dec 6 10:06:21 2006 New Revision: 35367 Modified: kupu/trunk/kupu/doc/PLONE2.txt kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html kupu/trunk/kupu/plone/xmlconfig.kupu Log: Htmlfilter should not disappear just because we have no tag/attribute filters. Fixed docs for widget styles. Modified: kupu/trunk/kupu/doc/PLONE2.txt ============================================================================== --- kupu/trunk/kupu/doc/PLONE2.txt (original) +++ kupu/trunk/kupu/doc/PLONE2.txt Wed Dec 6 10:06:21 2006 @@ -440,18 +440,19 @@ (description='Please paste or type your article here', label='Body Copy', parastyles=( - ('div|pullQuote','Pull Quote'), - ('div|Caption','Caption'), - ('div|contactInformation','Contact Information'), - ('div|notesToEditors','Notes to editors'), + 'div|pullQuote|Pull Quote', + 'div|Caption|Caption', + 'div|contactInformation|Contact Information', + 'div|notesToEditors|Notes to editors', ), ), ), -``parastyles`` is a sequence of style definitions. Each definition should -be a 2-tuple of strings. The first string if either the tag to be -added, or tag, vertical bar, class to be assigned to the tag. The -second string is the caption that appears in the style pulldown. +``parastyles`` is a sequence of style definitions. Each definition +should be a string as for the style definitions in the control panel +containing the tag to be added, vertical bar, class to be assigned to +the tag, vertical bar, description that appears in the style pulldown. +The class may be omitted, so tag, vertical bar, description is also valid. Images ------ @@ -499,7 +500,7 @@ text/x-html-captioned and output type text/html. * On the portal_transforms policy tab add a policy with output - type=text/x-html-captioned, uses transforms='html-to-captioned'. + type=text/x-html-safe, uses transforms='html-to-captioned'. This will force the captioning transform to be applied before the safe_html transform. Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html ============================================================================== --- kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html (original) +++ kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html Wed Dec 6 10:06:21 2006 @@ -19,7 +19,7 @@ - + @@ -57,7 +57,7 @@