-
Notifications
You must be signed in to change notification settings - Fork 87
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
Remove Internet Explorer 11 specific logic from KTextTruncator #652
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
11a2f6e
Remove Internet Explorer 11 specific logic from KTextTruncator
dfde8b0
add fix to changelog
2ec8467
Update CHANGELOG.md
Nivas7 afca8b6
Remove Internet Explorer 11 specific logic from KTextTruncator
Nivas7 6771725
fixing linting errors
Nivas7 15c16dd
Update changelog
MisRob 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 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 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 |
---|---|---|
|
@@ -32,10 +32,6 @@ | |
/** | ||
* Truncates text to a certain number of lines | ||
* and adds an ellipsis character "…" | ||
* | ||
* Internet Explorer note: | ||
* Depending on length of words of the text, there might | ||
* be a gap between the last visible word and "…" | ||
*/ | ||
export default { | ||
name: 'KTextTruncator', | ||
|
@@ -56,15 +52,6 @@ | |
required: false, | ||
default: 1, | ||
}, | ||
/** | ||
* Text line height in rem. | ||
* Used only for Internet Explorer fallback. | ||
*/ | ||
lineHeightIE: { | ||
type: Number, | ||
required: false, | ||
default: 1.4, | ||
}, | ||
}, | ||
computed: { | ||
truncate() { | ||
|
@@ -101,47 +88,9 @@ | |
// needed to make line clamp work for very long word with no spaces | ||
overflowWrap: 'break-word', | ||
}; | ||
} else { | ||
/* | ||
(C) | ||
Fallback for multiple lines in Internet Explorer and some older versions | ||
of other browsers that don't support line clamp | ||
(https://caniuse.com/mdn-css_properties_-webkit-line-clamp). | ||
Calculate max height and add "..." in `::before` while covering it with | ||
white rectangle defined in `::after` when text doesn't need to be truncated. | ||
Adapted from https://hackingui.com/a-pure-css-solution-for-multiline-text-truncation/ | ||
and https://css-tricks.com/line-clampin/#the-hide-overflow-place-ellipsis-pure-css-way. | ||
*/ | ||
const ellipsisWidth = '1rem'; | ||
return { | ||
overflow: 'hidden', | ||
position: 'relative', | ||
lineHeight: `${this.lineHeightIE}rem`, | ||
maxHeight: `${this.maxLines * this.lineHeightIE}rem`, | ||
// needed to make truncation work for very long word with no spaces | ||
// `word-wrap` is a legacy name for `overflow-wrap` that needs to be used for IE | ||
wordWrap: 'break-word', | ||
// create space for "..." | ||
paddingRight: ellipsisWidth, | ||
marginRigth: `-${ellipsisWidth}`, | ||
'::before': { | ||
content: "'…'", | ||
position: 'absolute', | ||
right: 0, | ||
bottom: 0, | ||
}, | ||
// cover "..." with white rectangle when text | ||
// doesn't need to be truncated | ||
'::after': { | ||
content: "''", | ||
position: 'absolute', | ||
right: 0, | ||
width: ellipsisWidth, | ||
height: '100%', | ||
background: this.$themeTokens.surface, | ||
}, | ||
}; | ||
} | ||
// Default return value for when neither condition is met | ||
return {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't be needed, see #652 (comment) |
||
}, | ||
}, | ||
}; | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these changes have anything to do with the modal, possibly result of copy-paste? Please cleanup.