Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: init watermark plugin #111

Merged
merged 15 commits into from
May 6, 2024
Merged

Conversation

pengzhanbo
Copy link
Member

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Provide a description in this PR that addresses what the PR is solving. If this PR is going to solve an existing issue, please reference the issue (e.g. close #123).

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Other

Description

Integrate watermark-js-plus into VuePress。

This plugin can add watermark to the pages, you can choose between add watermark globally or on specific pages. You can also choose between add text watermark or image watermark.

@Mister-Hope
Copy link
Member

I think the docs should be detailed telling defineWatermarkConfig can used to add hooks to watermark.

plugins/plugin-watermark/src/node/watermarkPlugin.ts Outdated Show resolved Hide resolved
plugins/plugin-watermark/src/node/watermarkPlugin.ts Outdated Show resolved Hide resolved
plugins/plugin-watermark/src/shared/options.ts Outdated Show resolved Hide resolved
plugins/plugin-watermark/src/shared/options.ts Outdated Show resolved Hide resolved
plugins/plugin-watermark/src/node/watermarkPlugin.ts Outdated Show resolved Hide resolved
Copy link
Member

@Mister-Hope Mister-Hope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need some tweaks in shared folder, make sure they should be used at both side.

For example the plugin option containing pageFilter is a node side one, then it should be node/options.ts

This ensures that these kind of types can not be imported in wrong side.

plugins/plugin-watermark/src/shared/options.ts Outdated Show resolved Hide resolved
plugins/plugin-watermark/src/shared/options.ts Outdated Show resolved Hide resolved
plugins/plugin-watermark/src/node/watermarkPlugin.ts Outdated Show resolved Hide resolved
@Mister-Hope
Copy link
Member

Mister-Hope commented May 3, 2024

LGTM, I leave a comment at a check of image, check that, maybe you want to mean or?

@coveralls
Copy link

coveralls commented May 3, 2024

Pull Request Test Coverage Report for Build 8969158557

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 50.304%

Totals Coverage Status
Change from base Build 8965251344: 0.0%
Covered Lines: 698
Relevant Lines: 1255

💛 - Coveralls

Mister-Hope
Mister-Hope previously approved these changes May 5, 2024
Copy link
Member

@Mister-Hope Mister-Hope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost LGTM, I will make some tweaks later

@Mister-Hope
Copy link
Member

Currently this PR is blocked by the latest commit at main. I am still figuring out that.

@Mister-Hope
Copy link
Member

BTW, could you add some e2e tests?

@pengzhanbo
Copy link
Member Author

BTW, could you add some e2e tests?

When I run pnpm e2e:dev locally, I noticed that the webServer.command in playwright.config.ts is not being executed at all. Playwright starts running the tests without waiting for http://127.0.0.1:9080 to return 200 OK. I have to run pnpm docs:dev first before pnpm e2e:dev runs correctly.

@Mister-Hope

This comment was marked as outdated.

Copy link
Member

@Mister-Hope Mister-Hope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix e2e tests plz

@pengzhanbo
Copy link
Member Author

Fix e2e tests plz

Done

@Mister-Hope
Copy link
Member

Mister-Hope commented May 6, 2024

@pengzhanbo Hi, I rebuild the plugin, and you are welcomed to review this for me.

The rebuild is containing:

  • A reuseable composable which can be imported and used from @vuepress/plugin-watermark/client directly without calling the plugin.
  • replace global and filter with enabled
  • WatermarkPureOptions instead of WatermarkAttrOptions and WatermarkOptions is only available at client.
  • Fixing options.image issue
  • A lot of code refactor to improve quality.
  • isInsideApp to determine whether the parent may be sensitive with routing.

@Mister-Hope Mister-Hope merged commit 969b03b into vuepress:main May 6, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants