小编Luk*_*und的帖子

如何在CKEditor 5中启用图像上传支持?

我将使用ckeditor v5进入我的项目.我试图使用图片插件,但我找不到有关它的足够信息.

如果你在这里看到Demoe ,你可以使用Drag&Drop轻松上传图像.但是,当我尝试拖放图像时,我会尝试使用下载气囊拉链时没有任何反应.也没有错误.

有没有办法在downladable变体中使用此图像支持?

javascript ckeditor ckeditor5

9
推荐指数
4
解决办法
2万
查看次数

如何在 Entity Framework Core 3 中无键播种数据?

描述

\n\n

我想将数据播种到我的数据库中。数据没有键或 ID 值。但由于某种原因我收到了错误:

\n\n
System.NullReferenceException: Object reference not set to an instance of an object.\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.get_IsKeyUnknown()\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.PropagateToUnknownKey(EntityState oldState, EntityState entityState, Boolean adding, Nullable`1 forceStateWhenUnknownKey)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState entityState, Boolean acceptChanges, Boolean modifyProperties, Nullable`1 forceStateWhenUnknownKey)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.Microsoft.EntityFrameworkCore.Update.IUpdateEntry.set_EntityState(EntityState value)\n   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.TrackData(IModel source, IModel target)\n   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.Diff(IModel source, IModel target, DiffContext diffContext)\n   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.GetDifferences(IModel source, IModel target)\n   at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.ScaffoldMigration(String migrationName, String rootNamespace, String subNamespace, String language)\n   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)\n   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)\n …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core asp.net-core-mvc .net-core

6
推荐指数
0
解决办法
1543
查看次数

如何使用 express 和 ejs 包含 html 文件

代码

我想让我的网页模块化,这样我就不需要一次又一次地写我的东西。我以为我的解决方案是 ejs lib。所以我使用了配置如下的 express 和 ejs:

const app = express();
app.engine('.html', require('ejs').renderFile);
app.set('view engine', 'html');
app.set('views', __dirname + '/wwwroot/views');
Run Code Online (Sandbox Code Playgroud)

我的视图文件夹结构如下所示:

wwwroot
  static
    css
    js
  views
    login
      index.html
    profile
      dashboard.html
    templates
      inc_header.html
      inc_footer.html
Run Code Online (Sandbox Code Playgroud)

我的仪表盘有以下内容

<% include templates/inc_header.html %>

This is my dashboard
Run Code Online (Sandbox Code Playgroud)

问题

头文件将不包括在内。我试过 wwwroot/views/templates/header.html 和 header.html。什么都行不通。

我的整个服务器配置

app.engine('.html', require('ejs').renderFile);
app.set('view engine', 'html');
app.set('views', __dirname + '/wwwroot/views');

app.use(session({
    secret: program.secret || "secret",
    resave: true,
    saveUninitialized: true
}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }))
app.use('/', express.static(path.join(__dirname, '/wwwroot/static/')));
Run Code Online (Sandbox Code Playgroud)

网络服务器上的输出

<% include templates/inc_header.html %> …

html javascript ejs node.js express

5
推荐指数
1
解决办法
5239
查看次数

如果未定义,请检查多个变量

理念

我想查看更多的参数,如果它们是undefined.如果我做这样的事情,它会工作:

if(param1 === undefined || param2 === undefined || param3 === undefined) {
    console.log('Is missing');
}
Run Code Online (Sandbox Code Playgroud)

但是我有6个以上的参数,如果我可以做这样的事情会很好:

if((param1 || param2 || param3) === undefined) {
    console.log('Is missing');
}
Run Code Online (Sandbox Code Playgroud)

问题

如果例如param3未定义,则第二个代码部分不会返回"Is missing".

javascript

0
推荐指数
1
解决办法
46
查看次数