升级到.net5;增加文章栏目、商品分类快速修改排序;增加jwt授权登录

This commit is contained in:
2020-12-02 18:11:54 +08:00
parent cfd8f02ef4
commit 7ed117d054
36 changed files with 1044 additions and 852 deletions
@@ -1,5 +1,11 @@
# CKEditor 4 Export to PDF Plugin Changelog
## ckeditor4-plugin-exportpdf 1.0.1
Other Changes:
* Improved external CSS support for [Classic Editor](https://ckeditor.com/docs/ckeditor4/latest/examples/classic.html) by handling exceptions and displaying convenient [error messages](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_errors.html#exportpdf-stylesheets-incaccessible).
## ckeditor4-plugin-exportpdf 1.0.0
The first stable release of the CKEditor 4 WYSIWYG Editor Export to PDF plugin. After a few months of the beta phase, testing and listening to community feedback, the CKEditor 4 Export to PDF plugin is stable and can be used with full confidence. Enjoy!
@@ -1,6 +1,6 @@
(function(){bender.loadExternalPlugin("exportpdf","/apps/plugin/");CKEDITOR.plugins.load("exportpdf",function(){function c(a,b){var c=exportPdfUtils.getDefaultConfig("unit",a||{});bender.editorBot.create({name:"editor"+Date.now(),config:c,startupData:"\x3cp\x3eHello World!\x3c/p\x3e"},function(a){b&&b(a.editor)})}var b=function(){var a=sinon.fakeServer.create(),b=0;a.respondWith(function(a){"/incremental_token"===a.url?(a.respond(200,{},"sample-token-value"+b),b+=1):"/empty-token"===a.url?a.respond(200,
{},""):a.respond(200,{},"sample-token-value")});return a}(),d;bender.test({setUp:function(){bender.tools.ignoreUnsupportedEnvironment("exportpdf");d=sinon.stub(CKEDITOR.plugins.exportpdf,"downloadFile")},tearDown:function(){d.restore()},"test token is fetched if tokenUrl is correct":function(){c({exportPdf_tokenUrl:"/custom-url"},function(a){a.on("exportPdf",function(a){assert.areEqual(a.data.token,"sample-token-value","Token value is incorrect.")},null,null,17);b.respond();a.execCommand("exportPdf");
b.respond()})},"test authentication header is added if token is provided":function(){c({exportPdf_tokenUrl:"/custom-url"},function(a){b.respond();a.execCommand("exportPdf");b.respond();assert.areEqual("sample-token-value",b.requests[b.requests.length-1].requestHeaders.Authorization,"Authorization token was not set properly.")})},"test console.warn is called if tokenUrl is not provided":function(){CKEDITOR.once("log",function(a){a.cancel();assert.areEqual("exportpdf-no-token-url",a.data.errorCode,
"There should be URL error log.")});c({exportPdf_tokenUrl:""})},"test console.warn is called on POST request if token is empty":function(){CKEDITOR.once("log",function(a){a.cancel();assert.areEqual("exportpdf-no-token",a.data.errorCode,"`exportpdf-no-token` should occur.")});c({exportPdf_tokenUrl:"/empty-token"},function(a){b.respond();a.execCommand("exportPdf");b.respond()})},"test console.warn is called on POST request if token was not fetched at all":function(){CKEDITOR.once("log",function(a){a.cancel();
assert.areEqual("exportpdf-no-token",a.data.errorCode,"`exportpdf-no-token` should occur.")});c({exportPdf_tokenUrl:"/custom-url"},function(a){a.execCommand("exportPdf");b.respond()})},"test token refreshes in the declared intervals":function(){CKEDITOR.once("instanceCreated",function(a){a.editor.exportPdfTokenInterval=200});c({exportPdf_tokenUrl:"/incremental_token"},function(a){b.respond();setTimeout(function(){resume(function(){b.respond();a.on("exportPdf",function(a){assert.areNotSame(a.data.token,
"sample-token-value0","Token was not refreshed.")},null,null,17);a.execCommand("exportPdf");b.respond()})},500);wait()})},"test file is downloaded also without token":function(){c({exportPdf_tokenUrl:"/empty-token"},function(a){b.respond();a.execCommand("exportPdf");b.respond();sinon.assert.calledOnce(d);assert.pass()})}})})})();
(function(){bender.loadExternalPlugin("exportpdf","/apps/plugin/");CKEDITOR.plugins.load("exportpdf",function(){function d(a,c){var b=exportPdfUtils.getDefaultConfig("unit",a||{});bender.editorBot.create({name:"editor"+Date.now(),config:b,startupData:"\x3cp\x3eHello World!\x3c/p\x3e"},function(a){c&&c(a.editor)})}var b=function(){var a=sinon.fakeServer.create(),c=0;a.respondWith(function(a){"/incremental_token"===a.url?(a.respond(200,{},"sample-token-value"+c),c+=1):"/empty-token"===a.url?a.respond(200,
{},""):a.respond(200,{},"sample-token-value")});return a}(),e;bender.test({setUp:function(){bender.tools.ignoreUnsupportedEnvironment("exportpdf");e=sinon.stub(CKEDITOR.plugins.exportpdf,"downloadFile")},tearDown:function(){e.restore()},"test token is fetched if tokenUrl is correct":function(){d({exportPdf_tokenUrl:"/custom-url"},function(a){a.on("exportPdf",function(a){assert.areEqual(a.data.token,"sample-token-value","Token value is incorrect.")},null,null,17);b.respond();a.execCommand("exportPdf");
b.respond()})},"test authentication header is added if token is provided":function(){d({exportPdf_tokenUrl:"/custom-url"},function(a){b.respond();a.execCommand("exportPdf");b.respond();assert.areEqual("sample-token-value",b.requests[b.requests.length-1].requestHeaders.Authorization,"Authorization token was not set properly.")})},"test console.warn is called if tokenUrl is not provided":function(){CKEDITOR.once("log",function(a){a.cancel();assert.areEqual("exportpdf-no-token-url",a.data.errorCode,
"There should be URL error log.")});d({exportPdf_tokenUrl:""})},"test console.warn is called on POST request if token is empty":function(){var a=CKEDITOR.on("log",function(c){"exportpdf-no-token"===c.data.errorCode&&(c.cancel(),CKEDITOR.removeListener("log",a),assert.areEqual("exportpdf-no-token",c.data.errorCode,"`exportpdf-no-token` should occur."))});d({exportPdf_tokenUrl:"/empty-token"},function(a){b.respond();a.execCommand("exportPdf");b.respond()})},"test console.warn is called on POST request if token was not fetched at all":function(){var a=
CKEDITOR.on("log",function(c){"exportpdf-no-token"===c.data.errorCode&&(c.cancel(),CKEDITOR.removeListener("log",a),assert.areEqual("exportpdf-no-token",c.data.errorCode,"`exportpdf-no-token` should occur."))});d({exportPdf_tokenUrl:"/custom-url"},function(a){a.execCommand("exportPdf");b.respond()})},"test token refreshes in the declared intervals":function(){CKEDITOR.once("instanceCreated",function(a){a.editor.exportPdfTokenInterval=200});d({exportPdf_tokenUrl:"/incremental_token"},function(a){b.respond();
setTimeout(function(){resume(function(){b.respond();a.on("exportPdf",function(a){assert.areNotSame(a.data.token,"sample-token-value0","Token was not refreshed.")},null,null,17);a.execCommand("exportPdf");b.respond()})},500);wait()})},"test file is downloaded also without token":function(){d({exportPdf_tokenUrl:"/empty-token"},function(a){b.respond();a.execCommand("exportPdf");b.respond();sinon.assert.calledOnce(e);assert.pass()})}})})})();
@@ -5,4 +5,5 @@ b.once("exportPdf",function(a){a.cancel();assert.areEqual(a.data.html,"")});b.on
"A5")});b.once("exportPdf",function(a){a.data.options.format="A5"},null,null,1);b.execCommand("exportPdf")})},"test html changed via event asynchronously":function(){bender.editorBot.create({name:"editor5",config:exportPdfUtils.getDefaultConfig("unit")},function(c){var b=c.editor;c.setHtmlWithSelection('\x3cp id\x3d"test"\x3eHello, World!\x3c/p\x3e^');b.on("exportPdf",function(a){a.cancel();a.data.asyncDone&&(resume(),assert.areEqual(a.data.html,"\x3cp\x3eContent filtered!\x3c/p\x3e"),delete a.data.asyncDone,
assert.isUndefined(a.data.asyncDone))});b.on("exportPdf",function(a){a.data.asyncDone||setTimeout(function(){a.data.html="\x3cp\x3eContent filtered!\x3c/p\x3e";a.data.asyncDone=!0;b.fire("exportPdf",a.data)},1E3)},null,null,1);b.execCommand("exportPdf");wait()})},"test options changed via event asynchronously":function(){bender.editorBot.create({name:"editor6",config:exportPdfUtils.getDefaultConfig("unit",{exportPdf_options:{format:"A5"}})},function(c){var b=c.editor;c.setHtmlWithSelection('\x3cp id\x3d"test"\x3eHello, World!\x3c/p\x3e^');
b.on("exportPdf",function(a){a.cancel();a.data.asyncDone&&(resume(),assert.areEqual(a.data.options.format,"A4"),delete a.data.asyncDone,assert.isUndefined(a.data.asyncDone))});b.on("exportPdf",function(a){a.data.asyncDone||setTimeout(function(){a.data.options.format="A4";a.data.asyncDone=!0;b.fire("exportPdf",a.data)},1E3)},null,null,1);b.execCommand("exportPdf");wait()})},"test default CKEditor config":function(){bender.editorBot.create({name:"editor7",config:exportPdfUtils.getDefaultConfig("unit")},
function(c){CKEDITOR.config.exportPdf_isDev?assert.areEqual(c.editor.config.exportPdf_service,"https://pdf-converter.cke-cs-staging.com/v1/convert","Default dev endpoint is incorrect."):assert.areEqual(c.editor.config.exportPdf_service,"https://pdf-converter.cke-cs.com/v1/convert","Default prod endpoint is incorrect.");assert.areEqual(c.editor.config.exportPdf_fileName,"ckeditor4-export-pdf.pdf","Default file name is incorrect.")})}})})})();
function(c){CKEDITOR.config.exportPdf_isDev?assert.areEqual(c.editor.config.exportPdf_service,"https://pdf-converter.cke-cs-staging.com/v1/convert","Default dev endpoint is incorrect."):assert.areEqual(c.editor.config.exportPdf_service,"https://pdf-converter.cke-cs.com/v1/convert","Default prod endpoint is incorrect.");assert.areEqual(c.editor.config.exportPdf_fileName,"ckeditor4-export-pdf.pdf","Default file name is incorrect.")})},"test inaccessible stylesheets are handled correctly":function(){bender.editorBot.create({name:"editor8",
config:exportPdfUtils.getDefaultConfig("unit",{contentsCss:"https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css"})},function(c){var b=c.editor,a=!1,d=CKEDITOR.on("log",function(b){"exportpdf-stylesheets-inaccessible"===b.data.errorCode&&(b.cancel(),CKEDITOR.removeListener("log",d),a=!0)});c.setHtmlWithSelection('\x3cp id\x3d"test"\x3eHello, World!\x3c/p\x3e^');b.once("exportPdf",function(b){b.cancel();a?assert.pass():assert.fail()},null,null,19);b.execCommand("exportPdf")})}})})})();
@@ -10,8 +10,10 @@
exportPdfUtils.initManualTest();
CKEDITOR.replace( 'editor1', exportPdfUtils.getDefaultConfig( 'manual', {
extraPlugins: 'exportpdf,notification'
extraPlugins: 'exportpdf'
} ) );
CKEDITOR.replace( 'editor2', exportPdfUtils.getDefaultConfig( 'manual' ) );
CKEDITOR.replace( 'editor2', exportPdfUtils.getDefaultConfig( 'manual', {
removePlugins: 'notification'
} ) );
</script>
@@ -1,7 +1,7 @@
@bender-tags: exportpdf, feature, 4
@bender-ui: collapsed
@bender-include: ../_helpers/tools.js
@bender-ckeditor-plugins: wysiwygarea, toolbar
@bender-ckeditor-plugins: wysiwygarea, toolbar, notification
1. Read the expected results first as there will be a sequence of things happening quickly to examine.
1. Click `Export to PDF` button in the first editor.
@@ -10,11 +10,12 @@
exportPdfUtils.initManualTest();
CKEDITOR.replace( 'editor1', exportPdfUtils.getDefaultConfig( 'manual', {
extraPlugins: 'exportpdf,notification',
extraPlugins: 'exportpdf',
exportPdf_service: 'https://cksource.com'
} ) );
CKEDITOR.replace( 'editor2', exportPdfUtils.getDefaultConfig( 'manual', {
removePlugins: 'notification',
exportPdf_service: 'https://cksource.com'
} ) );
</script>
@@ -1,7 +1,7 @@
@bender-tags: exportpdf, feature, 4
@bender-ui: collapsed
@bender-include: ../_helpers/tools.js
@bender-ckeditor-plugins: wysiwygarea, toolbar
@bender-ckeditor-plugins: wysiwygarea, toolbar, notification
**Note:** Errors in console during this test are allowed.