Skip to content
Snippets Groups Projects
Commit 106e617c authored by Daniel Hornung's avatar Daniel Hornung
Browse files

Merge branch 'f-fix-linkify-preview' into 'dev'

F fix linkify preview

See merge request !94
parents 63d405a7 49134a86
No related branches found
No related tags found
2 merge requests!103Quick main-release of documentation,!94F fix linkify preview
Pipeline #34594 passed
......@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
* `caosdb-v-property-linkified` css class to denote properties that have been
linkified already.
### Changed (for changes in existing functionality)
### Deprecated
......@@ -16,29 +19,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* [#199](https://gitlab.com/caosdb/caosdb-webui/-/issues/199) - Linkify creates
additional links after showing previews of referenced entities
### Security
### Documentation
## [0.10.1] - 2023-02-14
### Added
### Changed (for changes in existing functionality)
### Deprecated
### Removed
### Fixed
* [#194](https://gitlab.com/caosdb/caosdb-webui/-/issues/194) - Properties
remain hidden in previews of referenced entities
### Security
### Documentation
## [0.10.0] - 2022-12-19
(Florian Spreckelsen)
......
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2021-2023 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
* Copyright (C) 2023 Florian Spreckelsen <f.spreckelsen@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
......@@ -37,7 +38,7 @@ var cosmetics = new function () {
var _linkify = function () {
$('.caosdb-f-property-text-value').each(function (index) {
if (/https?:\/\//.test(this.innerText)) {
if (!($(this).hasClass("caosdb-v-property-linkified")) && (/https?:\/\//.test(this.innerText))) {
var result = this.innerText.replace(/https?:\/\/[^\s]*/g, function (href, index) {
var link_text = href;
if (_link_cut_off_length > 4 && link_text.length > _link_cut_off_length) {
......@@ -47,6 +48,9 @@ var cosmetics = new function () {
return `<a title="Open ${href} in a new tab." target="_blank" class="caosdb-v-property-href-value" href="${href}">${link_text} <i class="bi bi-box-arrow-up-right"></i></a>`;
});
// add class to highlight that this has been linkified already
// (see https://gitlab.com/caosdb/caosdb-webui/-/issues/199).
$(this).addClass("caosdb-v-property-linkified")
$(this).hide();
$(this).after(result);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment