-
Notifications
You must be signed in to change notification settings - Fork 1
Initial implementation #1
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
Merged
Merged
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
51290a1
feat: add initial implementation
mlopezFC f6385b9
build: update to Vaadin 24.4.0.beta5
mlopezFC b070d2f
fix: use stylename as the state name
mlopezFC 3d06b5d
fix(demo): fix initial demo values
mlopezFC 7305e63
fix: fix issue caused by null style initial value
mlopezFC 863cfbe
docs: update license headers
mlopezFC ac113f0
docs: update license header
mlopezFC 8de2dd2
build: fix addon name in scm section
mlopezFC d8515e1
build: fix inception year
mlopezFC c49c77b
build: fix group id
mlopezFC 9004001
docs: replace README default values with correct ones
mlopezFC 1719ec2
docs: add javadocs
mlopezFC 042f5b6
fix: use correct default style and content
mlopezFC c63e770
test: add basic unit testing
mlopezFC ec5cc99
build: use correct group id
mlopezFC 5bae572
docs: fix Maven Central badge
mlopezFC 33b36fe
docs: fix spelling of add-on
mlopezFC 4eb83d2
test: use correct tag name
mlopezFC 01397ea
docs: fix vaadin directory badges
mlopezFC 19841b0
docs: fix vaadin directory url
mlopezFC 60be801
docs: add javadoc for enums
mlopezFC 5732a78
fix: correct routes to make them similar to other addons
mlopezFC b8b1d25
build: use latest commons demo version
mlopezFC 029378f
chore: replace addon name in ISSUE_TEMPLATE
mlopezFC 0498cd3
chore: fix how to ignore resources
mlopezFC 0c1b4c3
feat(demo): add missing @GithubBranch annotation
mlopezFC 6a62014
feat: improve constructors
mlopezFC aff45fd
docs: improve javadocs
mlopezFC c162ee4
refactor: use a BaseSyntaxHighlighter class to reuse code
mlopezFC 052586f
docs: add missing javadoc
mlopezFC 01a1de1
fix: use correct property name
mlopezFC a65bfb0
docs: remove initial lines
mlopezFC f09d555
docs: use allowed instead of whitelisted
mlopezFC 3e67144
docs: update the location of the released and snapshot versions
mlopezFC e02cb60
fix: rename wrapLines attribute to wrapLongLines
mlopezFC 18fe5f9
refactor: use correct camel case capitalization for SHLanguage class
mlopezFC 2085551
refactor(demo): use multiline text blocks
mlopezFC 8ec224a
refactor: fix camel case capitalization for SHLanguagePrism class
mlopezFC 05264c0
refactor: use correct camel case capitalization for SHStyle class
mlopezFC 9be66ef
refactor: use correct camel case capitalization for SHStylePrism class
mlopezFC a9842e4
refactor: fix capitalization of getters and setters of SHLanguage
mlopezFC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
#%L | ||
Syntax Highlighter Add-on | ||
%% | ||
Copyright (C) 2024 Flowing Code | ||
%% | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
#L% | ||
--> | ||
|
||
<!-- | ||
This file is auto-generated by Vaadin. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<style> | ||
body, #outlet { | ||
height: 100vh; | ||
width: 100%; | ||
margin: 0; | ||
} | ||
</style> | ||
<!-- index.ts is included here automatically (either by the dev server or during the build) --> | ||
</head> | ||
<body> | ||
<!-- This outlet div is where the views are rendered --> | ||
<div id="outlet"></div> | ||
</body> | ||
</html> |
77 changes: 77 additions & 0 deletions
77
src/main/java/com/flowingcode/vaadin/addons/syntaxhighlighter/BaseSyntaxHighlighter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.flowingcode.vaadin.addons.syntaxhighlighter; | ||
|
||
import com.vaadin.flow.component.HasSize; | ||
import com.vaadin.flow.component.react.ReactAdapterComponent; | ||
|
||
/** | ||
* Base class for SyntaxHighlighters | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class BaseSyntaxHighlighter extends ReactAdapterComponent implements HasSize { | ||
|
||
/** | ||
* Returns true if the wrapLongLines feature is enabled | ||
* More info: https://github.com/react-syntax-highlighter/react-syntax-highlighter?tab=readme-ov-file#props | ||
* @return true if the wrapLongLines feature is enabled | ||
*/ | ||
public boolean isWrapLongLines() { | ||
return getState("wrapLongLines", Boolean.class); | ||
} | ||
|
||
/** | ||
* Enable or disable the wrapLongLines feature | ||
* @param wrapLongLines boolean to enable or disable the wrapLongLines feature | ||
*/ | ||
public void setWrapLongLines(boolean wrapLongLines) { | ||
setState("wrapLongLines", wrapLongLines); | ||
} | ||
|
||
/** | ||
* Returns true if the showLineNumbers feature is enabled | ||
* More info: https://github.com/react-syntax-highlighter/react-syntax-highlighter?tab=readme-ov-file#props | ||
* @return true if the showLineNumbers feature is enabled | ||
*/ | ||
public boolean isShowLineNumbers() { | ||
return getState("showLineNumbers", Boolean.class); | ||
} | ||
|
||
/** | ||
* Enable or disable the showLineNumbers feature | ||
* @param showLineNumbers boolean to enable or disable the showLineNumbers feature | ||
*/ | ||
public void setShowLineNumbers(boolean showLineNumbers) { | ||
setState("showLineNumbers", showLineNumbers); | ||
} | ||
|
||
/** | ||
* Returns the content of the Syntax Highlighter | ||
* @return string with the contents | ||
*/ | ||
public String getContent() { | ||
return getState("content", String.class); | ||
} | ||
|
||
/** | ||
* Sets the content of the Syntax Highlighter | ||
* @param content | ||
*/ | ||
public void setContent(String content) { | ||
setState("content", content); | ||
} | ||
|
||
/** | ||
* Sets the width of the Syntax Highlighter | ||
*/ | ||
@Override | ||
public void setWidth(String width) { | ||
getElement().executeJs("this.style.width = $0;", width); | ||
} | ||
|
||
/** | ||
* Obtains the width of the Syntax Highlighter | ||
*/ | ||
public void setHeight(String height) { | ||
getElement().executeJs("this.style.height = $0;", height); | ||
} | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.