小编che*_*xis的帖子

CKEditor内联在模态引导程序窗口中

我需要在模态引导程序中使用CKEditor内联,但它不起作用......

我已经阅读过这篇文章:如何在Bootstrap模式中使用CKEditor?

但它与我不同,因为我正在使用内联,我只需要将CKEditor应用于某些字段(我有其他使用contenteditable属性).

JS代码:

CKEDITOR.disableAutoInline = true;
CKEDITOR.inline('myModalLabel');
CKEDITOR.inline('bodyModal');

$.fn.modal.Constructor.prototype.enforceFocus = function () {
    modal_this = this
    $(document).on('focusin.modal', function (e) {
        if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length
        // add whatever conditions you need here:
        &&
        !$(e.target.parentNode).hasClass('cke_dialog_ui_input_select') && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
            modal_this.$element.focus()
        }
    })
};
Run Code Online (Sandbox Code Playgroud)

HTML代码

<button type="button" data-toggle="modal" data-target="#modalAddBrand">Launch modal</button>

<div class="modal fade" id="modalAddBrand" tabindex="-1" role="dialog" aria-labelledby="modalAddBrandLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                 <h4 class="modal-title" id="modalAddBrandLabel">add</h4>

            </div>
            <div class="modal-body">
                <form>
                    <textarea name="editor1" id="editor1" …
Run Code Online (Sandbox Code Playgroud)

jquery html5 ckeditor twitter-bootstrap

6
推荐指数
1
解决办法
3224
查看次数

OmniSharp.Dnx.DnxPaths指定的运行时路径"default"不存在

我正在尝试将OmniSharp与VisualStudio Code和ASP.NET 5(VNEXT)一起使用,但是当我尝试使用Omnisharp时,我遇到了这个问题:

[错误:OmniSharp.Dnx.DnxPaths]指定的运行时路径"default"不存在.搜索过的地点

我可以从命令行运行ASP.NET Web项目,我已经尝试将OmniSharpt与Sublime和Atom一起使用,但我遇到了同样的问题......

我已经逐步阅读了这个教程,除了这个问题之外一切正常......(我正在使用OSx El Capitan)

更多信息: https ://github.com/OmniSharp/omnisharp-roslyn/issues/347

有任何想法吗?

谢谢!!

omnisharp asp.net-core

6
推荐指数
2
解决办法
2152
查看次数

从类库访问到vNext中的appsetting.json或config.json

我正在创建一个Nuget包,我正在我的类库中工作.我需要访问appsetting.jsonconfig.json才能访问默认连接字符串.

将实际工作代码迁移到新版本的ASP.NET vNext的最佳方法是什么?

我在这个问题上已经读过它,但对我来说这是一个很好的解决方案.

工作代码:

/// <summary>
/// Retrieves the default connectionstring from the App.config or Web.config file.
/// </summary>
/// <returns>Returns the default connectionstring from the App.config or Web.config file.</returns>
public static string GetDefaultConnectionString()
{
    return ConfigurationManager.ConnectionStrings[DefaultConnectionstringName].ConnectionString;
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core

6
推荐指数
1
解决办法
5796
查看次数

在Mac OSX中更新dotnet cli

我正在尝试升级我的dotnet cli.我已从官方链接安装在我的Mac(OS El Capitan)中.

但是当我尝试使用此代码查看版本时:

dotnet --version

我的输出:

1.0.0-preview2-003121

我该如何升级?

谢谢.

.net-core asp.net-core dotnet-cli

6
推荐指数
1
解决办法
6197
查看次数

Phonegap,Cordova,xCode 4.4和Mountain Lion

昨天我清理了我的硬盘,并将我的OSX更新为Mountain Lion.我安装了xCode 4.4,之后,我下载并安装了PhoneGap 2.0.

问题是我无法使用Cordova Project的模板创建项目......就像我以前经常做的那样......

有谁知道问题出在哪里?

谢谢!!!

templates xcode4 cordova cordova-2.0.0

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

身份实体框架库 - 更新数据库[MySQL]

我刚刚将库Microsoft.AspNet.Identity.EntityFramework更新到最后一个版本(2.0.0.0),我发现创建表时出现了一些错误.当我生成迁移代码(向上和向下方法)时,我无法将更改上传到数据库,因为我在执行"Updata-Database"时遇到索引问题

指定密钥太长; 最大密钥长度为767字节

要执行的代码:

public override void Up()
    {
        CreateTable(
            "dbo.AspNetRoles",
            c => new
                {
                    Id = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
                    Name = c.String(nullable: false, maxLength: 256, storeType: "nvarchar"),
                })
            .PrimaryKey(t => t.Id)
            .Index(t => t.Name, unique: true, name: "RoleNameIndex");

        CreateTable(
            "dbo.AspNetUserRoles",
            c => new
                {
                    UserId = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
                    RoleId = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
                })
            .PrimaryKey(t => new { t.UserId, t.RoleId })
            .ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
            .ForeignKey("dbo.AspNetUsers", t …
Run Code Online (Sandbox Code Playgroud)

c# mysql entity-framework

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

多个长度为2的构造函数.无法消除Unity的歧义

我想使用DI与MongoDB的存储库类和接口,但它不起作用.我有这个错误:

MongoRepository`1类型有多个长度为2的构造函数.无法消除歧义.

班级建设者:

    public MongoRepository(string connectionString, string collectionName)
    {
        this.collection = Util<TKey>.GetCollectionFromConnectionString<T>(connectionString, collectionName);
    }


    public MongoRepository(MongoUrl url, string collectionName)
    {
        this.collection = Util<TKey>.GetCollectionFromUrl<T>(url, collectionName);
    }
Run Code Online (Sandbox Code Playgroud)

Unity配置:

container.RegisterType(typeof(MongoRepository.IRepository<>), typeof(MongoRepository.MongoRepository<>));
Run Code Online (Sandbox Code Playgroud)

如何在Unity中配置DI?谢谢!!

c# dependency-injection unity-container mongodb

5
推荐指数
2
解决办法
7157
查看次数

ASP.NET 5 vNext依赖注入(RoleManager)

我正在尝试像UserManager一样将RoleManager传递给我的控制器,但是我有这个错误:

处理请求时发生未处理的异常.

InvalidOperationException:尝试激活'Web.MongoDBIdentitySample.Controllers.AccountController'时,无法解析类型'Microsoft.AspNet.Identity.RoleManager`1 [Web.MongoDBIdentitySample.Models.ApplicationRole]'的服务.

这是我的ConfigureServices方法:

// This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        // Registers MongoDB conventions for ignoring default and blank fields
        // NOTE: if you have registered default conventions elsewhere, probably don't need to do this
        RegisterClassMap<ApplicationUser, IdentityRole, string>.Init();

        // Add Mongo Identity services to the services container.
        services.AddIdentity<ApplicationUser, IdentityRole>()
            .AddMongoDBIdentityStores<ApplicationDbContext, ApplicationUser, IdentityRole, string>(options =>
            {
                options.ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"];        // No default, must be …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core

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

版本弃用Facebook Graph API v2.2

我们的Facebook登录目前无效.我们收到了Facebook Developer Portal的消息:

"应用程序名称"目前可以访问Graph API v2.2,该版本将于2017年3月27日达到其2年生命周期的终点.为确保平稳过渡,请将所有调用迁移到Graph API v2.3或更高版本.

要检查您的应用是否会受到此升级的影响,您可以使用版本升级工具.这将显示哪些呼叫(如果有)受此更改影响以及更新版本中的任何替换呼叫.如果您没有看到任何电话,则您的应用可能不会受到此更改的影响.

您还可以使用我们的更改日志查看所有Graph API版本中的完整更改列表.

我们正在使用ASP.NET MVC 5,我们正在使用或认证如下:

var facebookAuthenticationOptions = new FacebookAuthenticationOptions()
            {
                AppId = "****",
                AppSecret = "****",
                AuthenticationType = "Facebook",
                SignInAsAuthenticationType = "ExternalCookie",
                Provider = new FacebookAuthenticationProvider
                {
                    OnAuthenticated = async ctx => ctx.Identity.AddClaim(new Claim(ClaimTypes.Email, ctx.User["email"].ToString()))
                }
            };

            facebookAuthenticationOptions.Scope.Add("email");
Run Code Online (Sandbox Code Playgroud)

但今天,我们的登录信息对象在ExternalLoginCallback中为null:

        [HttpGet]
        [AllowAnonymous]
        [RequireHttps]
        public async Task<ActionResult> ExternalLoginCallback(string returnUrl = null)
        {
            try
            {
                var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
                if (loginInfo == null)
                {
                    return RedirectToAction("Login");
                }
... more code here...
Run Code Online (Sandbox Code Playgroud)

在Facebook开发.Portal我们的API版本是2.3 …

asp.net-mvc facebook facebook-graph-api asp.net-mvc-5

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

Elastic Beanstalk 与 CloudWatch 日志和 Nginx

我已在 EBS 应用程序中激活 CloudWatch 日志。我已启用附加截图:

在此处输入图片说明

但是当我查看 awslogs.log 时,我总是可以找到这个错误:

cwlogs.push.stream - WARNING - 3317 - Thread-1 - No file is found with given path '/var/log/httpd/error.log*'.
cwlogs.push.stream - WARNING - 3317 - Thread-1 - No file is found with given path '/var/log/httpd/access.log*'.
Run Code Online (Sandbox Code Playgroud)

我不知道为什么,因为 httpd 是来自 Apache 的服务,而且我正在使用 Nginx(以 Node.js 作为源)。

如何禁用/删除此错误?

谢谢。

nginx amazon-web-services amazon-cloudwatch amazon-elastic-beanstalk

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