Skip to content
Draft
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9ea2df9
Merge pull request #134 from contentstack/staging
naveenctstack Jan 31, 2025
0cab523
Merge pull request #141 from contentstack/develop
Amitkanswal Apr 11, 2025
26841bc
sca-scan.yml
aravindbuilt Apr 15, 2025
5c723cd
policy-scan.yml
aravindbuilt Apr 15, 2025
54b583f
issues-jira.yml
aravindbuilt Apr 15, 2025
f5c6610
Delete jira.yml
aravindbuilt Apr 15, 2025
618c3cc
Delete sast-scan.yml
aravindbuilt Apr 15, 2025
9f9ce97
Updated codeowners
aravindbuilt Apr 15, 2025
d0c5046
policy-scan.yml
aravindbuilt Apr 16, 2025
012a3c7
issues-jira.yml
aravindbuilt Apr 16, 2025
8fa8f8f
Updated codeowners
aravindbuilt Apr 16, 2025
56f7058
policy-scan.yml
aravindbuilt Apr 23, 2025
d3ac706
fix: renamed org full page to global full page
naveenctstack Apr 10, 2025
a8320fa
Merge branch 'main' into staging
abhishek305 May 5, 2025
c69c874
policy-scan.yml
aravindbuilt May 5, 2025
3b571ff
issues-jira.yml
aravindbuilt May 5, 2025
e471fec
secrets-scan.yml
aravindbuilt May 5, 2025
8a28676
Updated codeowners
aravindbuilt May 5, 2025
7d37462
Merge branch 'main' into staging
aravindbuilt May 5, 2025
a2807cf
talismanrc file updated
aravindbuilt May 5, 2025
79640f8
Merge branch 'main' into staging
abhishek305 May 6, 2025
034debe
Merge pull request #143 from contentstack/staging
Amitkanswal May 9, 2025
844c083
Merge pull request #145 from contentstack/develop
Amitkanswal May 12, 2025
7336f3c
Merge branch 'main' into staging
Amitkanswal May 12, 2025
e95d897
Merge pull request #146 from contentstack/staging
Amitkanswal May 12, 2025
f6f6c12
feat(rte): Introduce PluginBuilder for declarative RTE plugin definition
rijil-tr Jun 5, 2025
d405dee
fix:updated exported format
Amitkanswal Jun 25, 2025
8530986
fix:added id's support in init
Amitkanswal Jun 26, 2025
3c1ed2f
doc:updated readme file with rte example
Amitkanswal Jun 26, 2025
f07f353
fix:updated mapper for initializationData
Amitkanswal Jun 27, 2025
2c19891
fix:test case
Amitkanswal Jun 27, 2025
861cbf1
fix:removed config mapper
Amitkanswal Jul 1, 2025
48b53d2
fix:updated render method
Amitkanswal Jul 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/issues-jira.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Create Jira Ticket for Github Issue

on:
issues:
types: [opened]

jobs:
issue-jira:
runs-on: ubuntu-latest
steps:

- name: Login to Jira
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

- name: Create Jira Issue
id: create_jira
uses: atlassian/gajira-create@master
with:
project: ${{ secrets.JIRA_PROJECT }}
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
description: |
*GitHub Issue:* ${{ github.event.issue.html_url }}

*Description:*
${{ github.event.issue.body }}
fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"
33 changes: 0 additions & 33 deletions .github/workflows/jira.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/policy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Checks the security policy and configurations
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-policy:
if: github.event.repository.visibility == 'public'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@master
- name: Checks for SECURITY.md policy file
run: |
if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi
security-license:
if: github.event.repository.visibility == 'public'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@master
- name: Checks for License file
run: |
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
license_file_found=false
current_year=$(date +"%Y")

for license_file in "${expected_license_files[@]}"; do
if [ -f "$license_file" ]; then
license_file_found=true
# check the license file for the current year, if not exists, exit with error
if ! grep -q "$current_year" "$license_file"; then
echo "License file $license_file does not contain the current year."
exit 2
fi
break
fi
done

if [ "$license_file_found" = false ]; then
echo "No license file found. Please add a license file to the repository."
exit 1
fi
11 changes: 0 additions & 11 deletions .github/workflows/sast-scan.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/secrets-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Secrets Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '2'
ref: '${{ github.event.pull_request.head.ref }}'
- run: |
git reset --soft HEAD~1
- name: Install Talisman
run: |
# Download Talisman
wget https://github.com/thoughtworks/talisman/releases/download/v1.37.0/talisman_linux_amd64 -O talisman

# Checksum verification
checksum=$(sha256sum ./talisman | awk '{print $1}')
if [ "$checksum" != "8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4" ]; then exit 1; fi

# Make it executable
chmod +x talisman
- name: Run talisman
run: |
# Run Talisman with the pre-commit hook
./talisman --githook pre-commit
5 changes: 5 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fileignoreconfig:
- filename: .github/workflows/secrets-scan.yml
ignore_detectors:
- filecontent
version: "1.0"
2 changes: 1 addition & 1 deletion src/RTE/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
IConfig,
IConfigCallback,
IContainerMetaData,
IOnFunction,
IPluginMetaData,
IRteParam,
IConfig,
} from "./types";

export class RTEPlugin {
Expand Down
12 changes: 6 additions & 6 deletions src/RTE/types.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { ReactElement } from "react";
import {
Editor,
ElementEntry,
Location,
Node,
NodeEntry,
NodeMatch,
Path,
Point,
Node,
ElementEntry,
Transforms,
Editor,
Span,
NodeMatch,
Transforms,
} from "slate";

import { RTEPlugin } from "./index";
Expand Down Expand Up @@ -199,7 +199,7 @@ export declare interface IRteElementType {
children: Array<IRteElementType | IRteTextType>;
}

type IDynamicFunction = (
export type IDynamicFunction = (
element: IRteElementType
) =>
| Exclude<IElementTypeOptions, "text">
Expand Down
31 changes: 28 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import postRobot from "post-robot";

import UiLocation from "./uiLocation";
import { version } from "../package.json";
import { InitializationData } from "./types";
import { RTEPlugin } from "./RTE";
import { IRteParam } from "./RTE/types";
import { PluginDefinition, registerPlugins,PluginBuilder } from "./rtePlugin";
import { InitializationData, IRTEInitData } from "./types";
import UiLocation from "./uiLocation";

postRobot.CONFIG.LOG_LEVEL = "error";

Expand All @@ -27,7 +30,6 @@ class ContentstackAppSDK {
* A static variable that stores the instance of {@link UiLocation} class after initialization
*/
static _uiLocation: UiLocation;

/**
* Initializes the App SDK and returns an instance of {@link UiLocation} class
*/
Expand All @@ -43,6 +45,28 @@ class ContentstackAppSDK {
.catch((e: Error) => Promise.reject(e));
}

/**
* Registers RTE plugins with the Contentstack platform.
* Contentstack platform loader, providing the `context` (initialization data) and
* the `rte` instance. When called, it materializes and returns a map of the
* registered `RTEPlugin` instances, keyed by their IDs.
*/
static async registerRTEPlugins(
...pluginDefinitions: PluginDefinition[]
): Promise<{
__isPluginBuilder__: boolean;
version: string;
plugins: (context: IRTEInitData, rte: IRteParam) => Promise<{
[key: string]: RTEPlugin;
}>;
}> {
return {
__isPluginBuilder__: true,
version,
plugins: registerPlugins(...pluginDefinitions)
};
}

/**
* Version of Contentstack App SDK.
*/
Expand All @@ -52,4 +76,5 @@ class ContentstackAppSDK {
}

export default ContentstackAppSDK;
export { PluginBuilder };
module.exports = ContentstackAppSDK;
Loading
Loading