npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lorenleedev/html-diff-for-ck-editor

v1.0.4

Published

Rendered Html Diff Library For CK-Editor

Downloads

378

Readme

ENGLISH Version

Project Description


This is a library that compares and visually renders the contents of CK-Editor

Demo


Link

How To Use


import diff from "@lorenleedev/html-diff-for-ck-editor";

const before = '<p>Your content, removed this!!</p>';
const after = '<p>Your content, added this!!</p>';

const resultStringHTML = diff(before, after);

// your ck-editor code
const editor = await ClassicEditor.create(element, {
  ... // your ck-editor options
  initialData: resultStringHTML 
});

For Image Diff


/*
* add thie code on your style
*/
.Diff-Editor-Image-Insert {
    background: rgba(102, 229, 119, .35);
    padding: 10px;
}

.Diff-Editor-Image-Delete {
    background: rgba(229, 102, 134,.35);
    padding: 10px;
}

ck-editor wraps image tags with figure tags. The FigureAttribute extension is needed to allow inserting classes into figure tags. Please refer to src/sample/CustomFigureAttributes.js in this repository for instructions on how to extend it.

KOREAN Version

프로젝트 설명


CK-Editor의 내용을 비교해 시각적으로 렌더링해주는 라이브러리입니다.

데모


Link

사용방법


import diff from "@lorenleedev/html-diff-for-ck-editor";

const before = '<p>에디터 내용이 삭제되었습니다!</p>';
const after = '<p>에디터 내용이 추가되었습니다!</p>';

const resultStringHTML = diff(before, after);

// ck-editor 코드에서 이렇게 사용합니다.
const editor = await ClassicEditor.create(element, {
  ... // your ck-editor options
  initialData: resultStringHTML 
});

이미지 비교를 위해 추가해야하는 로직


/*
* ck-editor를 사용하는 페이지에 아래 css를 추가하세요.
*/
.Diff-Editor-Image-Insert {
    background: rgba(102, 229, 119, .35);
    padding: 10px;
}

.Diff-Editor-Image-Delete {
    background: rgba(229, 102, 134,.35);
    padding: 10px;
}

ck-editor는 이미지 태그를 figure tag로 감싸고 있습니다. figure 태그에 class를 삽입할 수 있도록 FigureAttribute확장이 필요합니다. 확장하는 방법은 이 레파지토리의 src/sample/CustomFigureAttributes.js를 참고하세요.