是否有任何免费或廉价的Windows编辑器,允许编辑扩展名为.woff的文件(我在css中检查过该字体文件有woff扩展名).这些是由Google Webfonts提供的字体,它们可以自由嵌入,修改等.我只想在特定语言的某些字母上添加diactric重音并将字体嵌入到网站上.
在Angular2组件中,我使用EventEmitter发出带参数的事件.在父组件侦听器中,此参数未定义.这是一个plunker:
import {Component, EventEmitter, Output} from 'angular2/core'
@Component({
template: `<ul>
<li *ngFor="#product of products" (click)="onClick(product)">{{product.name}}</li>
</ul>`,
selector: 'product-picker',
outputs: ['pick']
})
export class ProductPicker {
products: Array<any>;
pick: EventEmitter<any>;
constructor() {
this.products = [
{id: 1, name: 'first product'},
{id: 2, name: 'second product'},
{id: 3, name: 'third product'},
];
this.pick = new EventEmitter();
}
onClick(product) {
this.pick.emit(product);
}
}
@Component({
selector: 'my-app',
providers: [],
template: `
<div>
<h2>Pick a product</h2>
<product-picker (pick)="onPick(item)"></product-picker>
</div>
<div>You picked: {{name}}</div>
`, …Run Code Online (Sandbox Code Playgroud) 我有一个与api服务器交互的服务.它有myHttpPost(数据)方法.这种方法应该:
我方法的当前版本是:
postData(path: string, data: Object): Rx.Observable<any> {
let json = JSON.stringify(data);
return this.http.post(path, json)
.map(res => res.json())
}
Run Code Online (Sandbox Code Playgroud)
这不是从上面的列表中进行的第3点,因为map仅在成功时调用,而不是在出错时调用.我可以通过添加以下内容来更改序列
.catch(error => {
let myError = prepareErrorContent(error);
return Rx.Observable.throw(myError);
});
Run Code Online (Sandbox Code Playgroud)
然后订阅者(另一个服务)收到myError(没关系),但是rxjs文档说明了以下关于catch()方法的内容:"继续使用下一个可观察序列的异常终止的可观察序列." 但我希望序列正常终止而不是继续.如果我使用catch()上面的类似,那么从订阅者下一次调用postData()不起作用(它会立即返回相同的错误,而不是进行http调用).我认为这是因为序列没有终止.
怎么做?
[编辑]这是我使用此服务的订阅者方法:
this.jsonHttp.postData(path, data)
.subscribe(
struct => onNext(struct),
error => {
let message = this.jsonHttp.extractError(error);
onError(message)
},
() => onComplete ? onComplete() : null
);
Run Code Online (Sandbox Code Playgroud) 我的页面上有一个默认的JQuery UI工具提示函数调用.有没有办法使用Inspector以交互方式设置工具提示div的样式?如果我有两个鼠标指针,一个将悬停在一个元素上以保持工具提示显示,第二个将使用Inspector并构建样式.但我只有一只鼠标,一旦它移出元素,工具提示就会消失.检查Inspector中的":hover"状态没有帮助.鼠标移出时工具提示消失.
我正在使用Chrome,但任何浏览器中的任何技巧都可以.
在Android Studio Profiler中,有两个位置显示应用程序占用的本机内存大小.
第一个位于水平栏中.Profiler 文档将其描述为:"Native:来自C或C++代码分配的对象的内存".
第二个位置是app heap dump,Native Size列.在文档中描述:"本机大小:此对象类型使用的本机内存总量(以字节为单位)"
在我的例子中,水平条显示30.12 MB,堆转储"本机大小"列显示大约9.28 MB(这是应用程序堆中具有非零本机大小列的所有对象的总和)
为什么这两种尺寸不同?
我尝试在我的应用程序中按照文档实现自定义错误处理程序,但不知道如何访问原始ErrorHandler堆栈跟踪的输出.为什么我需要原创?由原始ErrorHandler打印到控制台的堆栈跟踪是指来自typescript .ts文件的行号(至少对于我的app文件).自定义ErrorHandler中可用的堆栈跟踪是指来自javascript .js文件的行号.
Angular2应用程序示例如下:
文件main.ts
import {bootstrap} from 'angular2/platform/browser';
import {App} from './app';
import {ExceptionHandler, provide} from "angular2/core";
class MyExceptionHandler {
call(error, stackTrace = null, reason = null) {
let msg = ExceptionHandler.exceptionToString(error);
console.log(msg);
console.log('Message: ' + error.message);
console.log('Stack trace: ' + stackTrace);
}
}
bootstrap(App, [provide(ExceptionHandler, {useClass: MyExceptionHandler})]);
//bootstrap(App, []);
Run Code Online (Sandbox Code Playgroud)
文件app.ts
import {Component} from 'angular2/core'
@Component({
selector: 'my-app',
providers: [],
template: `<div><h2>Hello {{name}}</h2></div>`,
directives: []
})
export class App {
constructor() {
this.name = 'Angular2';
let arr …Run Code Online (Sandbox Code Playgroud) 是否有一个css编辑器(对于Windows)会显示颜色?或者更一般地,编辑器总是显示带有颜色背景的6个字符的十六进制值.
像这样:
div.myclass {
color: #ff8861; <- the background (or foreground, doesn't matter) of #ff8861 has orange color in the editor
}
Run Code Online (Sandbox Code Playgroud)
[编辑1]:不是一个所见即所得,只是一个显示颜色和语法的富文本编辑器
[编辑2]:理想情况下,它还应该支持LESS语法
我在<p>标签中的tinymce编辑器中有一些文本,没有别的,没有类,没有样式.当我选择文本并单击无序列表按钮,然后<p>成为一个列表.但每个<li>看起来像这样:
<li><span style="font-size: 12px; line-height: 1.5em;">Some text...</span></li>
这些样式来自哪里,哪个tinymce配置选项,哪个文件,哪个是什么??? 我希望列表按钮只添加列表html标签,没有任何跨度和样式.
这是我的tinymce配置.配置是直接从Chrome检查器复制的(这就是嵌套道具中没有缩进的原因):(断点位于第13547行,tinymce.add(t);在tiny_mce_src.js 中的语句处)
settings: Object
accessibility_focus: true
accessibility_warnings: false
add_form_submit_trigger: true
add_unload_trigger: true
apply_source_formatting: 0
bodyClass: "wysiwygeditor"
button_tile_map: true
content_css: "/sites/all/themes/adaptivetheme/at_core/css/at.layout.css,/sites/all/themes/atsl/css/global.base.css,/sites/all/themes/mytheme/css/global.styles.css
convert_fonts_to_spans: 1
convert_urls: false
delta_height: 0
delta_width: 0
dialog_type: "modal"
directionality: "ltr"
doctype: "<!DOCTYPE>"
document_base_url: "/"
entities: "quot,apos,amp,lt,gt,nbsp,iexcl"
entity_encoding: "named"
extended_valid_elements: ""
fix_table_elements: true
font_size_legacy_values: "xx-small,small,medium,large,x-large,xx-large,300%"
font_size_style_values: "xx-small,x-small,small,medium,large,x-large,xx-large"
forced_root_block: "p"
formats: Object
hidden_input: true
id: "edit-body-und-0-value"
ie7_compat: true
indent: "simple"
indent_after: "p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist"
indent_before: …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了一个新的 Next.js 应用程序。它有以下页面:
// /pages/articles/[slug].js
import React from 'react'
import { useRouter } from 'next/router'
import ErrorPage from 'next/error'
const Article = (props) => {
const router = useRouter()
if (router.isFallback) {
return <div>Loading..</div>
}
if (!props['data']) {
return <ErrorPage statusCode={404} />
}
return (
<div>
Article content
</div>
)
}
export default Article
export const getStaticProps = async(context) => {
const slug = context.params.slug
const res = ["a", "b", "c"].includes(slug)
? {
props: {
data: slug
}
}
: …Run Code Online (Sandbox Code Playgroud) ng-file-upload文档显示了使用示例.第一个示例小提示程序显示文件大小的验证消息:
<input type="file" ngf-select ng-model="picFile" name="file"
accept="image/*" ngf-max-size="2MB" required>
<i ng-show="myForm.file.$error.required">*required</i><br>
<i ng-show="myForm.file.$error.maxSize">File too large
{{picFile.size / 1000000|number:1}}MB: max 2M</i>
Run Code Online (Sandbox Code Playgroud)
但是,当我运行小提琴并上传大于2M的文件时,验证消息显示:
File too large MB: max 2M
Run Code Online (Sandbox Code Playgroud)
所以{{picFile.size / 1000000|number:1}}消息中没有表达.看起来好像picFile.size没有设定.有没有办法显示尺寸?