-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tomaskikutis/custom-blocks-customization
custom blocks customization
- Loading branch information
Showing
4 changed files
with
95 additions
and
38 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "client" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "server" # Location of package manifests | ||
schedule: | ||
interval: "daily" |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import {startApp} from 'superdesk-core/scripts/index'; | ||
|
||
setTimeout(() => { | ||
startApp( | ||
[ | ||
{ | ||
id: 'annotationsLibrary', | ||
load: () => import('superdesk-core/scripts/extensions/annotationsLibrary'), | ||
}, | ||
{ | ||
id: 'markForUser', | ||
load: () => import('superdesk-core/scripts/extensions/markForUser'), | ||
}, | ||
{ | ||
id: 'datetimeField', | ||
load: () => import('superdesk-core/scripts/extensions/datetimeField'), | ||
}, | ||
{ | ||
id: 'planning-extension', | ||
load: () => import('superdesk-planning/client/planning-extension'), | ||
}, | ||
{ | ||
id: 'broadcasting', | ||
load: () => import('superdesk-core/scripts/extensions/broadcasting').then((broadcasting) => { | ||
broadcasting.setCustomizations({ | ||
getRundownItemDisplayName: (rundown) => rundown.technical_title, | ||
}); | ||
|
||
return broadcasting; | ||
}), | ||
}, | ||
], | ||
{}, | ||
{ | ||
editor3: { | ||
customBlocks: { | ||
getAdditionalWrapperAttributes: (_vocabulary, html) => { | ||
function getHighestHeadingText(el: HTMLElement): string | null { | ||
const headings: Array<keyof HTMLElementTagNameMap> = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; | ||
|
||
for (const tag of headings) { | ||
const result = el.querySelector(tag); | ||
|
||
if (result != null) { | ||
return result.textContent; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
const tableCellContentElement: HTMLElement = | ||
new DOMParser().parseFromString(html, 'text/html').body; | ||
|
||
const replaceSpecialCharacters = (str) => | ||
str.normalize('NFD').replace(/[\u0300-\u036f]/g, '') // Remove accents | ||
.replace(/([^\w]+|\s+)/g, '-') // Replace space and other characters by hyphen | ||
.replace(/\-\-+/g, '-') // replace multiple hyphens with one hyphen | ||
.replace(/(^-+|-+$)/g, ''); // remove extra hyphens from beginning or end of the string | ||
|
||
const heading: string | null = getHighestHeadingText(tableCellContentElement); | ||
|
||
const attributes: Array<{name: string; value: string}> = [ | ||
{name: 'class', value: 'custom-block'}, | ||
]; | ||
|
||
if (heading != null) { | ||
attributes.push({name: 'data-custom-block-title', value: replaceSpecialCharacters(heading).toLocaleLowerCase()}); | ||
} | ||
|
||
return attributes; | ||
}, | ||
}, | ||
}, | ||
}, | ||
); | ||
}); | ||
|
||
export default angular.module('main.superdesk', []); |
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 |
---|---|---|
|
@@ -184,4 +184,4 @@ | |
# 2: reindex slugline | ||
SCHEMA_VERSION = 2 | ||
|
||
#CORRECTIONS_WORKFLOW = True | ||
# CORRECTIONS_WORKFLOW = True |