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

[editor] Add support for saving a newly added FreeText #14978

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

calixteman
Copy link
Contributor

No description provided.

@calixteman calixteman linked an issue Jun 1, 2022 that may be closed by this pull request
@calixteman calixteman changed the title [edition] Add support for saving a newly added FreeText [editor] Add support for saving a newly added FreeText Jun 1, 2022
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/document.js Show resolved Hide resolved
src/core/worker.js Outdated Show resolved Hide resolved
src/core/worker.js Show resolved Hide resolved
src/core/document.js Outdated Show resolved Hide resolved
web/app.js Outdated Show resolved Hide resolved
src/core/worker.js Outdated Show resolved Hide resolved
@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2022

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/8b7e7a4cf10a64d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2022

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/c8b74220bff33c7/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2022

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/8b7e7a4cf10a64d/output.txt

Total script time: 26.58 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 26
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/8b7e7a4cf10a64d/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2022

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/c8b74220bff33c7/output.txt

Total script time: 29.30 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/c8b74220bff33c7/reftest-analyzer.html#web=eq.log

src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
test/unit/annotation_spec.js Outdated Show resolved Hide resolved
Comment on lines 144 to 145
* Get the translation to use to position this editor when
* it's created.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Get the translation to use to position this editor when
* it's created.
* Get the translation used to position this editor when it's created.

Comment on lines 51 to 71
document.documentElement.style.setProperty(
"--freetext-padding",
`${INTERNAL_PADDING}px`
);
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Jun 8, 2022

Choose a reason for hiding this comment

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

How about simply reading the padding value as defined in the CSS file, rather than overwriting it here (with a value it should already have)?

Something like this could perhaps work:

const style = getComputedStyle(document.documentElement);
this._internalPadding = parseInt(
  style.getPropertyValue("--freetext-padding"),
  10
);

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, with one more comment and all tests passing; thank you!

Comment on lines 47 to 50
document.documentElement.style.setProperty(
"--freetext-line-height",
LINE_FACTOR
);
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Jun 8, 2022

Choose a reason for hiding this comment

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

Unless I'm completely misunderstanding the purpose of this code, you basically want to ensure that the CSS variable (as defined in web/annotation_editor_layer_builder.css) won't accidentally diverge from the internal constant?

If so, how about we just assert that in non-PRODUCTION mode instead?

if (
  typeof PDFJSDev === "undefined" ||
  PDFJSDev.test("!PRODUCTION || TESTING")
) {
  const lineHeight = parseFloat(
    style.getPropertyValue("--freetext-line-height")
  );
  assert(
    lineHeight === LINE_FACTOR,
    "Update the CSS variable to agree with the constant."
  );
}

Comment on lines 76 to 77
if (!AnnotationEditorLayer._l10nInitialized) {
AnnotationEditorLayer._l10nInitialized = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, maybe just call the property _initialized now since this is no longer just for l10n-handling?

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jun 8, 2022

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/53f6e5884b980be/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 8, 2022

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/f0dbdb42372f9eb/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 8, 2022

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/53f6e5884b980be/output.txt

Total script time: 26.72 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 24
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/53f6e5884b980be/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Jun 8, 2022

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/f0dbdb42372f9eb/output.txt

Total script time: 28.45 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for writing text
4 participants