mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Mass replace fontAttributes with fontWeight and fontStyle
This commit is contained in:
@ -9,11 +9,11 @@
|
||||
<StackLayout orientation="horizontal" row="1">
|
||||
<Label margin="2">
|
||||
<Label.formattedText>
|
||||
<FormattedString fontSize="20" foregroundColor="#C6C6C6">
|
||||
<FormattedString fontSize="20" color="#C6C6C6">
|
||||
<FormattedString.spans>
|
||||
<Span text="{{ author ? 'by ' + author : '' }}"/>
|
||||
<Span text="{{ num_comments ? ' | ' : '' }}" />
|
||||
<Span text="{{ num_comments ? num_comments + ' comments' : '' }}" foregroundColor="#10C2B0"/>
|
||||
<Span text="{{ num_comments ? num_comments + ' comments' : '' }}" color="#10C2B0"/>
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Label.formattedText>
|
||||
|
@ -6,8 +6,8 @@
|
||||
<Label.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="label" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Label" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="label" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="Label" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Label.formattedText>
|
||||
@ -16,8 +16,8 @@
|
||||
<Label.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="label" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Label" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="label" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="Label" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Label.formattedText>
|
||||
@ -28,8 +28,8 @@
|
||||
<Button.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="button" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Button" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="button" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="Button" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Button.formattedText>
|
||||
@ -38,8 +38,8 @@
|
||||
<Button.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="button" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Button" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="button" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="Button" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Button.formattedText>
|
||||
@ -50,8 +50,8 @@
|
||||
<TextField.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Field" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="text" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="Field" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</TextField.formattedText>
|
||||
@ -60,8 +60,8 @@
|
||||
<TextField.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Field" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="text" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="Field" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</TextField.formattedText>
|
||||
@ -72,8 +72,8 @@
|
||||
<TextView.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="View" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="text" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="View" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</TextView.formattedText>
|
||||
@ -82,8 +82,8 @@
|
||||
<TextView.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="View" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
<Span text="text" fontWeight="bold" color="#0000ff" />
|
||||
<Span text="View" fontStyle="italic" color="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</TextView.formattedText>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<StackLayout>
|
||||
<Label margin="2">
|
||||
<Label.formattedText>
|
||||
<FormattedString foregroundColor="White">
|
||||
<FormattedString color="White">
|
||||
<FormattedString.spans>
|
||||
<Span text="FormattedString foregroundColor cannot be set to named color" />
|
||||
<Span text="https://github.com/NativeScript/cross-platform-modules/issues/86"/>
|
||||
|
@ -696,7 +696,7 @@ export function test_parse_NestedRepeaters() {
|
||||
}
|
||||
|
||||
export function test_parseSpansDirectlyOnLabel() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Label id="testLabel"><Span text="We are" fontSize="10"/><Span text="Awesome" fontAttributes="Bold"/></Label></StackLayout></Page>');
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Label id="testLabel"><Span text="We are" fontSize="10"/><Span text="Awesome" fontWeight="bold"/></Label></StackLayout></Page>');
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testLabel = <Label>page.getViewById("testLabel");
|
||||
@ -709,7 +709,7 @@ export function test_parseSpansDirectlyOnLabel() {
|
||||
}
|
||||
|
||||
export function test_parseSpansDirectlyOnButton() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><Span text="We are" fontSize="10"/><Span text="Awesome" fontAttributes="Bold"/></Button></StackLayout></Page>');
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><Span text="We are" fontSize="10"/><Span text="Awesome" fontWeight="bold"/></Button></StackLayout></Page>');
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testButton = <Button>page.getViewById("testButton");
|
||||
|
2
tns-core-modules/ui/core/view.d.ts
vendored
2
tns-core-modules/ui/core/view.d.ts
vendored
@ -660,7 +660,7 @@ declare module "ui/core/view" {
|
||||
*/
|
||||
export interface ApplyXmlAttributes {
|
||||
/**
|
||||
* Called for every attribute in xml declaration. <... fontAttributes="bold" ../>
|
||||
* Called for every attribute in xml declaration. <... fontWeight="bold" ../>
|
||||
* @param attributeName - the name of the attribute (fontAttributes)
|
||||
* @param attrValue - the value of the attribute (bold)
|
||||
* Should return true if this attribute is handled and there is no need default handler to process it.
|
||||
|
Reference in New Issue
Block a user