Code Monkey home page Code Monkey logo

v-code-diff's People

Contributors

09473zh avatar cjboy76 avatar cpayton-abtech avatar dependabot[bot] avatar lruihao avatar qusaisabri avatar shenzhim avatar shimada666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

v-code-diff's Issues

1.0.0 version, better performance and more features.

In the 0.x version, the html is created by the diff2html plugin to create an html string and then mounted on the element. Although this is simple, it is difficult to add custom functions, and the rendering and highlighting performance and effects are not ideal. For example, it is difficult for me to add a feature that clicks to expand and collapse the content.
In the 1.x version, I hope I can render html by myself, control the generation of html by myself, and it is easier to add some features, but this takes a lot of time, and I will try my best to improve it. If you need new features such as expanding and collapsing content, you can try editors such as monaco first, or comment below. If there are more people who need it, I will finish it as soon as possible. thank you for your support.

在 0.x 版本中,样式是通过 diff2html 插件创建出 html 字符串然后挂载到元素上的,这虽然简单,但很难添加自定义功能,渲染和高亮的性能与效果也不够理想。例如,我很难加入一个点击展开折叠内容的功能。
在 1.x 版本中,我希望能自己来渲染 html,自己把控 html 的生成,更容易增加自定义功能,但这需要时间,我会尽力完善它的。如果你有需要如展开折叠内容等新功能,可以先尝试 monaco 等编辑器,也可以在下方评论,如果需要它的人比较多,我会尽早地去完成它。感谢您的支持。

vue使用CDN引入后,使用v-code-diff报错Uncaught (in promise) TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".

vite + vue3
vue本地运行开发无问题,发布打包,由于vue使用CDN,https://unpkg.com/[email protected]/dist/vue.global.js
项目运行报错:
v-code-diff是最新版本0.3.11

policy:1 Uncaught (in promise) TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".

关于无差异比对的一点疑问

问题:在使用比对功能时,对于无差异的场景,会额外多一行 File Without Change 的文本。
需求:因为没有差异的文本也需要看到内容(isShowNoChange设置为true),又不想要有 File Without Change 这一行(这有可能会让用户端认为这段代码存在差异)
疑问:我在vue-code-diff上使用的话,无差异比对是不会多出这一行的。我down了代码下来看,发现这一行文本是主动赋值上去的,请问这样做是因为现有方案不支持这种场景嘛,还是有什么其他考量

使用时直接报错

提示 diff2html 没有 diff.js 文件,去目录看了一下确实没有,应该是 diff2html 版本更改造成的?
希望修复一下。

bundle size critically high

Hey, I've been using the package with great success, but I ran into a slight concern.

I isolated the component down to lazy loading it by doing something like :

const CodeDiff = defineAsyncComponent(() =>
  import('v-code-diff').then(({ CodeDiff }) => CodeDiff)
);

But when building and minifying the app, Rollup and Vite still complain about minified chunk for the v-code-diff code to be over 1000KB.
Is there a possibility to reduce the component size ?

Thanks a lot!

不自动依赖所有highlight.js的语言包

参考Highlight.js主页的用法:
https://github.com/highlightjs/highlight.js

const hljs = require('highlight.js/lib/core');
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));

const highlightedCode = hljs.highlight('<span>Hello World!</span>', {language: 'xml'}).value

我实在是不需要语言高亮。将import hljs from 'highlight.js'替换为import * as hljs from 'highlight.js/lib/core'之后,js文件从1M减小到了100K。

另外Highlight.js官方有一个vue plugin:
https://github.com/highlightjs/vue-plugin

isShowNoChange时头部信息需要隐藏

if (props.isShowNoChange) { oldString = 'File Without Change\tOldString: ======================== \n' + oldString newString = 'File Without Change\tNewString: ======================== \n' + newString }
这一段可不可以去掉发一个小版本呢?

文件对比会受 /r /n影响

文件对比会受 /r /n影响 内容是一样的 但是因为看不见的/r /n导致差异 可以忽略这些差异吗

有些文件对比左右会错位

image
image
这种展示出来左右是错位的是什么原因
左侧数据:
{
"code": 0,
"data": [
"2022-05-18 16:02:30",
"2022-05-18 16:02:31",
"2022-05-18 16:02:32",
"2022-05-18 16:02:33",
"2022-05-18 16:02:34",
"2022-05-18 16:02:35",
"2022-05-18 16:02:36",
"2022-05-18 16:02:37",
"2022-05-18 16:02:38",
"2022-05-18 16:02:39"
],
"msg": "操作成功"
}
右侧数据:
{
"code": 0,
"data": [
"2022-05-18 18:04:37",
"2022-05-24 18:04:38",
"2022-05-24 18:04:39",
"2022-05-24 18:04:40",
"2022-05-24 18:04:41",
"2022-05-24 18:04:42",
"2022-05-24 18:04:43",
"2022-05-24 18:04:44",
"2022-05-24 18:04:45",
"2022-05-24 18:04:46"
],
"msg": "操作成功"
}

ie11报 script1010: 缺少标识符

把咱这个插件注释掉就可以进页面啦, 点击报错标识定位到了 (...e), 网上查了一下一般是使用了保留关键词 或者 json结尾有逗号, 去代码里没有定位到, 求大佬赐教

vue2 引入

大佬 vue2 引入报Cannot read properties of null (reading '$vnode'),0.3.12版本

vue2 使用问题

ERROR in /Users/momoQuasar/spacey/node_modules/v-code-diff/dist/v-code-diff/v-code-diff.d.ts(3,44):
TS2694: Namespace '"/Users/momoQuasar/spacey/node_modules/vue-demi/lib/index"' has no exported member 'DefineComponent'.
Version: typescript 4.2.2, eslint 7.32.0
Time: 3928 ms

Report type issue while using in Vue2 + Typescript | Vue2 + Typescript 中添加插件类型错误

My project is Vue2 + Typescript.
Now I'm using this awesome plugin, it did work, the diff result looks good in the web page.
But type checking always report issue.
It's annoying and can't pass the type check during project build, even though it still works.

感谢大佬的插件,用的是Vue2和Typescript,虽然页面可以正常使用,但是类型检查总是报错,在这里记录一下。

usage:

import Vue from 'vue';
import CodeDiff from 'v-code-diff';

Vue.use(CodeDiff);

report error:

No overload matches this call.
  Overload 1 of 2, '(plugin: PluginObject<unknown> | PluginFunction<unknown>, options?: unknown): VueConstructor<Vue>', gave the following error.
    Argument of type '{ install: (app: App<any>) => void; }' is not assignable to parameter of type 'PluginObject<unknown> | PluginFunction<unknown>'.
      Type '{ install: (app: App<any>) => void; }' is not assignable to type 'PluginObject<unknown>'.
        Types of property 'install' are incompatible.
          Type '(app: App<any>) => void' is not assignable to type 'PluginFunction<unknown>'.
            Types of parameters 'app' and 'Vue' are incompatible.
              Type 'VueConstructor<Vue>' is missing the following properties from type 'App<any>': mount, unmount
  Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>', gave the following error.
    Argument of type '{ install: (app: App<any>) => void; }' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
      Type '{ install: (app: App<any>) => void; }' is not assignable to type 'PluginObject<any>'.
        Types of property 'install' are incompatible.
          Type '(app: App<any>) => void' is not assignable to type 'PluginFunction<any>'.
            Types of parameters 'app' and 'Vue' are incompatible.
              Type 'VueConstructor<Vue>' is not assignable to type 'App<any>'.

字符串对比有不同的上面没有标深红,能帮忙看下吗

image
上面字符串:"recordResponse": "{"code":"200","data":{"createTime":"2022-05-11 14:40:10","createUserName":"赵铁军","createUserNo":"80037","employeeNo":"80037","idCard":"211221198110152419","modifiedTime":"2022-05-11 14:40:12","modifiedUserNo":"80037","status":"2","submitTime":"2022-05-11 14:40:12","submitUserName":"赵铁军","submitUserNo":"80037","weeklyId":"553007","workDate":"2022-05-11 00:00:00","workDay":"周三","workDayId":"2182485","workTotal":8.0},"msg":"提交成功","success":true}",
下面字符串:"recordResponse": "{"code":"200","data":{"createTime":"2022-05-11 14:40:10","createUserName":"赵铁军","createUserNo":"80037","employeeNo":"80037","idCard":"211221198110152419","modifiedTime":"2022-05-11 14:40:12","modifiedUserName":null,"modifiedUserNo":"80037","status":"2","submitTime":"2022-05-11 14:40:12","submitUserName":"赵铁军","submitUserNo":"80037",""80037","status":"2","submitTime":"2022-05-11 14:40:12","submitUserName":"赵铁军","submitUserNo":"80037","weeklyDayDetail":null,"weeklyId":"553007","workDate":"2022-05-11 00:00:00","workDay":"周三","workDayId":"2182485","workTotal":8.0},"msg":"提交成功","success":true}","553007","workDate":"2022-05-11 00:00:00","workDay":"周三","workDayId":"2182485","workTotal":8.0},"msg":"提交成功","success":true}",

context 参数值

如果文档所有篇幅都想展示,context的值的问题,不通过计算默认展示所有篇幅

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.